2 * This file is part of maemopad+
5 * This software is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1 of
8 * the License, or (at your option) any later version.
10 * This software is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this software; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 #include <hildon-widgets/hildon-program.h>
29 #include <ui/sketchwidget.h>
30 #include <hildon-widgets/hildon-color-button.h>
34 #define EXPANDING_ROWS
37 #ifndef EXPANDING_ROWS
38 #error EXPANDING_ROWS is needed for NEW_SEL_LOGIC
41 #define _(String) gettext(String)
43 #define USE_TEMP_TABLES
45 #ifdef USE_TEMP_TABLES
46 #define TEMPTABLE_KEYWORD " TEMP"
48 #define TEMPTABLE_KEYWORD ""
52 * confirmation responses
54 #define CONFRESP_YES 1
57 #define CONFRESP_CANCEL 4
58 #define CONFRESP_ERROR 5
60 #define BRUSHSIZE_COUNT 7
62 #define SKETCHNODE_X 288
63 #define SKETCHNODE_Y 96
64 #define SKETCHNODE_RX 144
65 #define SKETCHNODE_RY 48
69 MAEMOPAD_NO_ERROR
= 0,
70 MAEMOPAD_ERROR_INVALID_URI
,
71 MAEMOPAD_ERROR_SAVE_FAILED
,
72 MAEMOPAD_ERROR_OPEN_FAILED
85 NODEFLAG_SKETCHLINES
= 1 << 0,
86 NODEFLAG_SKETCHGRAPH
= 1 << 1
88 * NODEFLAG_OTHER = 1 << 2
89 * NODEFLAG_OTHER2 = 1 << 3
101 typedef struct _nodeData nodeData
;
110 unsigned long lastMod
;
115 * Struct to include view's information
117 typedef struct _MainView MainView
;
121 * Handle to app's data
126 /*old (guint fullscreen): 0:normal 1:notree-normal 2:normal-full 3:notree-full 4:justdoc-full */
127 /*new (guint viewflags): 1:tree 2:toolbar 4:fullscreen*/
132 GtkWidget
*file_item
;
133 GtkWidget
*tools_item
;
134 GtkWidget
*new_node_item
;
135 GtkWidget
*delete_node_item
;
136 GtkWidget
*expand_collapse_node_item
;
137 GtkWidget
*export_node_item
;
139 GtkWidget
*open_item
;
140 GtkWidget
*save_item
;
141 GtkWidget
*edit_item
;
143 GtkWidget
*copy_item
;
144 GtkWidget
*paste_item
;
145 GtkWidget
*clear_item
;
146 GtkWidget
*tools_brushsize
;
147 GtkWidget
*tools_pagestyle
;
148 GtkWidget
*tools_shape
;
149 GtkWidget
*tools_font
;
150 GtkWidget
*tools_color
;
151 GtkWidget
*view_item
;
153 GtkWidget
*brushsizemenu
;
154 GtkWidget
*sketchlinesmenu
;
156 GtkWidget
*shapemenu
;
164 GtkToolItem
*toggletree_tb
;
169 * GtkToolItem* open_tb;
171 GtkToolItem
*save_tb
;
172 GtkToolItem
*separator_tb1
;
175 * GtkToolItem* cut_tb;
176 * GtkToolItem* copy_tb;
177 * GtkToolItem* paste_tb;
178 * GtkToolItem* separator_tb2;
180 GtkToolItem
*font_tb
;
181 GtkWidget
*colorbutton
;
182 GtkToolItem
*colorbutton_tb
;
183 GtkWidget
*viewmenuitems
[3];
185 GtkToolItem
*brushsize_tb
;
186 GtkWidget
*brushsizemenuitems
[BRUSHSIZE_COUNT
];
188 GtkToolItem
*eraser_tb
;
190 GtkToolItem
*sketchlines_tb
;
191 GtkWidget
*sketchlinesmenuitems
[3];
193 GtkToolItem
*undo_tb
;
194 GtkToolItem
*redo_tb
;
196 GtkToolItem
*shape_tb
;
197 GtkWidget
*shapemenuitems
[4];
202 GtkWidget
*scrolledwindow
; /* textview is under this widget */
203 GtkWidget
*textview
; /* widget that shows the text */
204 GtkTextBuffer
*buffer
; /* buffer that contains the text */
205 GtkClipboard
*clipboard
; /* clipboard for copy/paste */
208 GtkWidget
*scrolledtree
; /* scrolledwindow for the tree */
209 GtkWidget
*hpaned
; /* hpaned between tree and document */
212 guint brushsize_backup
;
214 PangoFontDescription
*font_desc
; /* font used in textview */
216 GdkCursor
*cursorBusy
;
219 gboolean file_edited
; /* for node operations and notification of new stuff in tmptable */
226 nodeData
*cansel_node
;
230 gboolean newnodedialog_createchild
;
233 #define datatable_name "nodes"
234 #define datatable_tmpname "tmpnodes"
235 #define datatable_backupname "nodesbackup"
237 #define datatable "( \
238 nodeid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \
239 parent INTEGER NOT NULL DEFAULT 0, \
240 bodytype INTEGER NOT NULL DEFAULT 0, \
245 lastmodified INTEGER NOT NULL DEFAULT 0, \
246 ord INTEGER NOT NULL DEFAULT 0, \
247 flags INTEGER NOT NULL DEFAULT 0);"
249 #define dataindex "(parent, ord);"
251 #define misctable_name "settings"
252 #define misctable "(skey TEXT UNIQUE, sval TEXT);"
254 #define datatableversion 1
259 void sk_set_brushsize(MainView
* main
, guint bsize
);
260 MainView
*interface_main_view_new(AppData
* data
);
261 void interface_main_view_destroy(MainView
* main
);
262 gchar
*interface_file_chooser(MainView
* mainview
, GtkFileChooserAction action
, gchar
* suggname
, gchar
* suggext
);
263 PangoFontDescription
*interface_font_chooser(MainView
* main
);
264 gint
interface_create_new_file(MainView
* main
);