作図ソフト dia の改良版
Revisão | 38f5db3be15093f03543628cf608a7deed66e8b7 (tree) |
---|---|
Hora | 2015-01-12 05:11:50 |
Autor | Hans Breuer <hans@breu...> |
Commiter | Hans Breuer |
[cleanup] Reduce special handling with (ddisp->menu_bar == NULL)
probably since GtkAction usage there is no need for different code paths anymore
@@ -832,15 +832,10 @@ ddisplay_set_snap_to_grid(DDisplay *ddisp, gboolean snap) | ||
832 | 832 | GtkToggleAction *snap_to_grid; |
833 | 833 | ddisp->grid.snap = snap; |
834 | 834 | |
835 | - if (ddisp->menu_bar == NULL) { | |
836 | - snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid")); | |
837 | - if (is_integrated_ui ()) | |
838 | - integrated_ui_toolbar_grid_snap_synchronize_to_display (ddisp); | |
839 | - } else { | |
840 | - snap_to_grid = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewSnaptogrid")); | |
841 | - } | |
842 | - /* Currently, this can cause double emit, but that's a small problem. | |
843 | - */ | |
835 | + snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid")); | |
836 | + if (is_integrated_ui ()) | |
837 | + integrated_ui_toolbar_grid_snap_synchronize_to_display (ddisp); | |
838 | + /* Currently, this can cause double emit, but that's a small problem. */ | |
844 | 839 | gtk_toggle_action_set_active (snap_to_grid, ddisp->grid.snap); |
845 | 840 | ddisplay_update_statusbar(ddisp); |
846 | 841 | } |
@@ -864,16 +859,10 @@ ddisplay_set_snap_to_objects(DDisplay *ddisp, gboolean magnetic) | ||
864 | 859 | GtkToggleAction *mainpoint_magnetism; |
865 | 860 | ddisp->mainpoint_magnetism = magnetic; |
866 | 861 | |
867 | - if (ddisp->menu_bar == NULL) { | |
868 | - mainpoint_magnetism = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptoobjects")); | |
869 | - if (is_integrated_ui ()) | |
870 | - integrated_ui_toolbar_object_snap_synchronize_to_display (ddisp); | |
871 | - } else { | |
872 | - mainpoint_magnetism = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewSnaptoobjects")); | |
873 | - } | |
874 | - | |
875 | - /* Currently, this can cause double emit, but that's a small problem. | |
876 | - */ | |
862 | + mainpoint_magnetism = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptoobjects")); | |
863 | + if (is_integrated_ui ()) | |
864 | + integrated_ui_toolbar_object_snap_synchronize_to_display (ddisp); | |
865 | + /* Currently, this can cause double emit, but that's a small problem. */ | |
877 | 866 | gtk_toggle_action_set_active (mainpoint_magnetism, ddisp->mainpoint_magnetism); |
878 | 867 | ddisplay_update_statusbar(ddisp); |
879 | 868 | } |
@@ -1337,33 +1326,24 @@ display_update_menu_state(DDisplay *ddisp) | ||
1337 | 1326 | GtkToggleAction *show_cx_pts; |
1338 | 1327 | GtkToggleAction *antialiased; |
1339 | 1328 | |
1340 | - if (ddisp->menu_bar == NULL) { | |
1341 | - rulers = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowrulers")); | |
1342 | - visible_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowgrid")); | |
1343 | - snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid")); | |
1344 | - show_cx_pts = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowconnectionpoints")); | |
1345 | - antialiased = GTK_TOGGLE_ACTION (menus_get_action ("ViewAntialiased")); | |
1346 | - } else { | |
1347 | - rulers = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewShowrulers")); | |
1348 | - visible_grid = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewShowgrid")); | |
1349 | - snap_to_grid = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewSnaptogrid")); | |
1350 | - show_cx_pts = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewShowconnectionpoints")); | |
1329 | + rulers = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowrulers")); | |
1330 | + visible_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowgrid")); | |
1331 | + snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid")); | |
1332 | + show_cx_pts = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowconnectionpoints")); | |
1333 | + antialiased = GTK_TOGGLE_ACTION (menus_get_action ("ViewAntialiased")); | |
1351 | 1334 | |
1352 | - antialiased = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewAntialiased")); | |
1353 | - } | |
1354 | 1335 | gtk_action_set_sensitive (menus_get_action ("ViewAntialiased"), |
1355 | 1336 | g_type_from_name ("DiaCairoInteractiveRenderer") != 0 || g_type_from_name ("DiaLibartRenderer") != 0); |
1356 | 1337 | |
1357 | - | |
1358 | 1338 | ddisplay_do_update_menu_sensitivity (ddisp); |
1359 | 1339 | |
1360 | 1340 | gtk_toggle_action_set_active (rulers, display_get_rulers_showing(ddisp)); |
1361 | 1341 | gtk_toggle_action_set_active (visible_grid, |
1362 | - ddisp->grid.visible); | |
1342 | + ddisp->grid.visible); | |
1363 | 1343 | gtk_toggle_action_set_active (snap_to_grid, |
1364 | - ddisp->grid.snap); | |
1344 | + ddisp->grid.snap); | |
1365 | 1345 | gtk_toggle_action_set_active (show_cx_pts, |
1366 | - ddisp->show_cx_pts); | |
1346 | + ddisp->show_cx_pts); | |
1367 | 1347 | |
1368 | 1348 | gtk_toggle_action_set_active (antialiased, |
1369 | 1349 | ddisp->aa_renderer); |