• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

修訂2c7f0103b325cf0f216d940585482a0c6714d240 (tree)
時間2004-05-05 20:36:04
作者Lars Clausen <lclausen@src....>
CommiterLars Clausen

Log Message

Better undo

Change Summary

差異

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
1+2004-05-05 Lars Clausen <lars@raeder.dk>
2+
3+ * app/dia-props.c (diagram_properties_respond):
4+ * app/diagram.c (diagram_set_modified):
5+ * app/undo.c:
6+ * app/disp_callbacks.c:
7+ * app/commands.c:
8+ * app/load_save.c (diagram_save):
9+ Better handling of undo and modified status -- only diagram
10+ properties and page setup explicitly set modified status, all
11+ other important changes should be done through the undo stack
12+ now.
13+
114 2004-05-04 Lars Clausen <lars@raeder.dk>
215
316 * app/app_procs.c (app_init): Consistently open a new diagram if
--- a/app/commands.c
+++ b/app/commands.c
@@ -311,8 +311,10 @@ insert_text(DDisplay *ddisp, Focus *focus, const gchar *text)
311311 diagram_flush(ddisp->diagram);
312312 }
313313
314- if (any_modified)
314+ if (any_modified) {
315+ diagram_modified(ddisp->diagram);
315316 undo_set_transactionpoint(ddisp->diagram->undo);
317+ }
316318 }
317319
318320
@@ -428,6 +430,7 @@ edit_cut_text_callback(gpointer data, guint action, GtkWidget *widget)
428430 object_add_updates(obj, ddisp->diagram);
429431 undo_object_change(ddisp->diagram, obj, change);
430432 undo_set_transactionpoint(ddisp->diagram->undo);
433+ diagram_modified(ddisp->diagram);
431434 diagram_flush(ddisp->diagram);
432435 }
433436 }
@@ -483,6 +486,7 @@ edit_undo_callback(gpointer data, guint action, GtkWidget *widget)
483486 dia = ddisp->diagram;
484487
485488 undo_revert_to_last_tp(dia->undo);
489+ diagram_modified(dia);
486490
487491 diagram_flush(dia);
488492 }
@@ -497,6 +501,7 @@ edit_redo_callback(gpointer data, guint action, GtkWidget *widget)
497501 dia = ddisp->diagram;
498502
499503 undo_apply_to_next_tp(dia->undo);
504+ diagram_modified(dia);
500505
501506 diagram_flush(dia);
502507 }
@@ -1045,6 +1050,7 @@ objects_align_h_callback(gpointer data, guint action, GtkWidget *widget)
10451050 diagram_update_connections_selection(dia);
10461051 object_add_updates_list(objects, dia);
10471052 diagram_flush(dia);
1053+ diagram_modified(dia);
10481054
10491055 undo_set_transactionpoint(dia->undo);
10501056 }
@@ -1066,6 +1072,7 @@ objects_align_v_callback(gpointer data, guint action, GtkWidget *widget)
10661072 diagram_update_connections_selection(dia);
10671073 object_add_updates_list(objects, dia);
10681074 diagram_flush(dia);
1075+ diagram_modified(dia);
10691076
10701077 undo_set_transactionpoint(dia->undo);
10711078 }
--- a/app/dia-props.c
+++ b/app/dia-props.c
@@ -272,8 +272,8 @@ diagram_properties_respond(GtkWidget *widget,
272272 {
273273 Diagram *active_diagram = ddisplay_active_diagram();
274274
275- if (response_id != GTK_RESPONSE_OK ||
276- response_id != GTK_RESPONSE_APPLY) {
275+ if (response_id == GTK_RESPONSE_OK ||
276+ response_id == GTK_RESPONSE_APPLY) {
277277 if (active_diagram) {
278278 active_diagram->data->grid.dynamic =
279279 gtk_toggle_button_get_active(GTK_CHECK_BUTTON(dynamic_check));
@@ -293,6 +293,7 @@ diagram_properties_respond(GtkWidget *widget,
293293 &active_diagram->data->pagebreak_color);
294294 diagram_add_update_all(active_diagram);
295295 diagram_flush(active_diagram);
296+ diagram_set_modified(active_diagram, TRUE);
296297 }
297298 }
298299 if (response_id != GTK_RESPONSE_APPLY)
--- a/app/diagram.c
+++ b/app/diagram.c
@@ -214,32 +214,38 @@ diagram_destroy(Diagram *dia)
214214 gboolean
215215 diagram_is_modified(Diagram *dia)
216216 {
217- return dia->mollified;
217+ return dia->mollified || !undo_is_saved(dia->undo);
218218 }
219219
220+/** We might just have change the diagrams modified status.
221+ * This doesn't set the status, but merely updates the display.
222+ */
220223 void
221224 diagram_modified(Diagram *dia)
222225 {
223- diagram_set_modified(dia, TRUE);
226+ GSList *displays;
227+ displays = dia->displays;
228+ while (displays != NULL) {
229+ DDisplay *display = (DDisplay*) displays->data;
230+ ddisplay_update_statusbar(display);
231+ displays = g_slist_next(displays);
232+ }
233+ if (diagram_is_modified(dia)) dia->autosaved = FALSE;
234+ /* diagram_set_modified(dia, TRUE);*/
224235 }
225236
237+/** Set this diagram explicitly modified. This should not be called
238+ * by things that change the undo stack, as those modifications are
239+ * noticed through changes in the undo stack.
240+ */
226241 void
227242 diagram_set_modified(Diagram *dia, int modified)
228243 {
229- GSList *displays;
230-
231244 if (dia->mollified != modified)
232245 {
233246 dia->mollified = modified;
234- displays = dia->displays;
235- while (displays != NULL)
236- {
237- DDisplay *display = (DDisplay*) displays->data;
238- ddisplay_update_statusbar(display);
239- displays = g_slist_next(displays);
240- }
241247 }
242- dia->autosaved = FALSE;
248+ diagram_modified(dia);
243249 }
244250
245251 /* ************ Functions that check for menu sensitivity ********* */
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -375,11 +375,11 @@ static void handle_key_event(DDisplay *ddisp, Focus *focus, guint keysym,
375375 object_add_updates(obj, ddisp->diagram);
376376
377377 if (modified) {
378- diagram_modified(ddisp->diagram);
379378 if (obj_change != NULL) {
380379 undo_object_change(ddisp->diagram, obj, obj_change);
381380 undo_set_transactionpoint(ddisp->diagram->undo);
382381 }
382+ diagram_modified(ddisp->diagram);
383383 }
384384
385385 diagram_flush(ddisp->diagram);
@@ -942,9 +942,9 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
942942 list = g_list_prepend(NULL, obj);
943943 undo_insert_objects(ddisp->diagram, list, 1);
944944 diagram_update_extents(ddisp->diagram);
945- diagram_modified(ddisp->diagram);
946945
947946 undo_set_transactionpoint(ddisp->diagram->undo);
947+ diagram_modified(ddisp->diagram);
948948 if (prefs.reset_tools_after_create)
949949 tool_reset();
950950 return obj;
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -921,8 +921,8 @@ diagram_save(Diagram *dia, const char *filename)
921921 }
922922
923923 dia->unsaved = FALSE;
924- diagram_set_modified (dia, FALSE);
925924 undo_mark_save(dia->undo);
925+ diagram_set_modified (dia, FALSE);
926926
927927 diagram_cleanup_autosave(dia);
928928