| 39 #include "../ui/properties.h" |
39 #include "../ui/properties.h" |
| 40 #include "../common/context.h" |
40 #include "../common/context.h" |
| 41 #include "../common/menu.h" |
41 #include "../common/menu.h" |
| 42 #include "../common/toolbar.h" |
42 #include "../common/toolbar.h" |
| 43 #include "../common/object.h" |
43 #include "../common/object.h" |
| |
44 #include "../common/utils.h" |
| 44 |
45 |
| 45 #include <cx/mempool.h> |
46 #include <cx/mempool.h> |
| 46 |
47 |
| 47 static int window_default_width = 650; |
48 static int window_default_width = 650; |
| 48 static int window_default_height = 550; |
49 static int window_default_height = 550; |
| 50 static int splitview_window_default_pos = -1; |
51 static int splitview_window_default_pos = -1; |
| 51 static UiBool splitview_window_use_prop = TRUE; |
52 static UiBool splitview_window_use_prop = TRUE; |
| 52 |
53 |
| 53 static void main_window_destroy(UiObject *obj) { |
54 static void main_window_destroy(UiObject *obj) { |
| 54 MainWindow *window = (__bridge MainWindow*)obj->wobj; |
55 MainWindow *window = (__bridge MainWindow*)obj->wobj; |
| |
56 [window saveWindowSize]; |
| 55 [[WindowManager sharedWindowManager] closeWindow:window]; |
57 [[WindowManager sharedWindowManager] closeWindow:window]; |
| 56 } |
58 } |
| 57 |
59 |
| 58 static UiObject* create_window(const char *title, BOOL simple, BOOL sidebar, BOOL splitview) { |
60 static UiObject* create_window(const char *title, BOOL simple, BOOL sidebar, BOOL splitview) { |
| 59 UiObject *obj = uic_object_new_toplevel(); |
61 UiObject *obj = uic_object_new_toplevel(); |
| 60 |
62 |
| 61 MainWindow *window = [[MainWindow alloc] init:obj withSidebar:sidebar withSplitview:splitview]; |
63 int width = window_default_width; |
| |
64 int height = window_default_height; |
| |
65 if(!simple) { |
| |
66 ui_get_window_default_width(&width, &height); |
| |
67 } |
| |
68 |
| |
69 MainWindow *window = [[MainWindow alloc] init:obj withSidebar:sidebar withSplitview:splitview width:width height:height]; |
| 62 |
70 |
| 63 obj->wobj = (__bridge void*)window; |
71 obj->wobj = (__bridge void*)window; |
| 64 obj->destroy = main_window_destroy; |
72 obj->destroy = main_window_destroy; |
| 65 |
73 |
| 66 MainWindowController *controller = [[MainWindowController alloc] initWithWindow:obj window:window]; |
74 MainWindowController *controller = [[MainWindowController alloc] initWithWindow:obj window:window]; |