1. === modified file 'src/widgets/spray-toolbar.cpp'
  2. --- src/widgets/spray-toolbar.cpp 2015-12-26 19:37:12 +0000
  3. +++ src/widgets/spray-toolbar.cpp 2016-01-25 13:53:23 +0000
  4. @@ -58,7 +58,7 @@
  5. //## Spray ##
  6. //########################
  7. -static void sp_stb_sensitivize( GObject *tbl )
  8. +static void sp_stb_update_widgets( GObject *tbl )
  9. {
  10. GtkAction* offset = GTK_ACTION( g_object_get_data(tbl, "offset") );
  11. GtkAction* spray_scale = GTK_ACTION( g_object_get_data(tbl, "spray_scale") );
  12. @@ -66,50 +66,59 @@
  13. GtkAdjustment *adj_scale = ege_adjustment_action_get_adjustment( EGE_ADJUSTMENT_ACTION(spray_scale) );
  14. GtkToggleAction *no_overlap = GTK_TOGGLE_ACTION( g_object_get_data(tbl, "no_overlap") );
  15. GtkToggleAction *picker = GTK_TOGGLE_ACTION( g_object_get_data(tbl, "picker") );
  16. - GtkAction* picker_action = GTK_ACTION( g_object_get_data(tbl, "picker") );
  17. GtkToggleAction *usepressurescale = GTK_TOGGLE_ACTION( g_object_get_data(tbl, "usepressurescale") );
  18. GtkAction *pick_fill = GTK_ACTION( g_object_get_data(tbl, "pick_fill") );
  19. GtkAction *pick_stroke = GTK_ACTION( g_object_get_data(tbl, "pick_stroke") );
  20. GtkAction *pick_inverse_value = GTK_ACTION( g_object_get_data(tbl, "pick_inverse_value") );
  21. GtkAction *pick_center = GTK_ACTION( g_object_get_data(tbl, "pick_center") );
  22. gtk_adjustment_set_value( adj_offset, 100.0 );
  23. - if (gtk_toggle_action_get_active(no_overlap) && gtk_action_get_sensitive(picker_action)) {
  24. - gtk_action_set_sensitive( offset, TRUE );
  25. + if (gtk_toggle_action_get_active(no_overlap)) {
  26. + gtk_action_set_visible( offset, true );
  27. } else {
  28. - gtk_action_set_sensitive( offset, FALSE );
  29. + gtk_action_set_visible( offset, false );
  30. }
  31. if (gtk_toggle_action_get_active(usepressurescale)) {
  32. gtk_adjustment_set_value( adj_scale, 0.0 );
  33. - gtk_action_set_sensitive( spray_scale, FALSE );
  34. + gtk_action_set_visible( spray_scale, false );
  35. } else {
  36. - gtk_action_set_sensitive( spray_scale, TRUE );
  37. + gtk_action_set_visible( spray_scale, true );
  38. }
  39. - if(gtk_toggle_action_get_active(picker) && gtk_action_get_sensitive(picker_action)){
  40. - gtk_action_set_sensitive( pick_fill, TRUE );
  41. - gtk_action_set_sensitive( pick_stroke, TRUE );
  42. - gtk_action_set_sensitive( pick_inverse_value, TRUE );
  43. - gtk_action_set_sensitive( pick_center, TRUE );
  44. + if(gtk_toggle_action_get_active(picker)){
  45. + gtk_action_set_visible( pick_fill, true );
  46. + gtk_action_set_visible( pick_stroke, true );
  47. + gtk_action_set_visible( pick_inverse_value, true );
  48. + gtk_action_set_visible( pick_center, true );
  49. } else {
  50. - gtk_action_set_sensitive( pick_fill, FALSE );
  51. - gtk_action_set_sensitive( pick_stroke, FALSE );
  52. - gtk_action_set_sensitive( pick_inverse_value, FALSE );
  53. - gtk_action_set_sensitive( pick_center, FALSE );
  54. + gtk_action_set_visible( pick_fill, false );
  55. + gtk_action_set_visible( pick_stroke, false );
  56. + gtk_action_set_visible( pick_inverse_value, false );
  57. + gtk_action_set_visible( pick_center, false );
  58. }
  59. }
  60. -static void sp_spray_erase_sensitivize( GObject *tbl, bool sensitive){
  61. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "no_overlap") ), sensitive );
  62. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "over_no_transparent") ), sensitive );
  63. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "over_transparent") ), sensitive );
  64. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_no_overlap") ), sensitive );
  65. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_stroke") ), sensitive );
  66. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_fill") ), sensitive );
  67. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_inverse_value") ), sensitive );
  68. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "pick_center") ), sensitive );
  69. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "picker") ), sensitive );
  70. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "offset") ), sensitive );
  71. - gtk_action_set_sensitive( GTK_ACTION( g_object_get_data(tbl, "spray_rotation") ), sensitive );
  72. - sp_stb_sensitivize( tbl );
  73. +static void sp_spray_init( GObject *tbl){
  74. + Inkscape::Preferences *prefs = Inkscape::Preferences::get();
  75. + int mode = prefs->getInt("/tools/spray/mode", 0);
  76. + bool show = true;
  77. + if(mode == 3){
  78. + show = false;
  79. + }
  80. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "no_overlap") ), show );
  81. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "over_no_transparent") ), show );
  82. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "over_transparent") ), show );
  83. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_no_overlap") ), show );
  84. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_stroke") ), show );
  85. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_fill") ), show );
  86. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_inverse_value") ), show );
  87. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_center") ), show );
  88. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "picker") ), show );
  89. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "offset") ), show );
  90. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "spray_rotation") ), show );
  91. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_fill") ), show );
  92. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_stroke") ), show );
  93. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_inverse_value") ), show );
  94. + gtk_action_set_visible( GTK_ACTION( g_object_get_data(tbl, "pick_center") ), show );
  95. + sp_stb_update_widgets( tbl );
  96. }
  97. Inkscape::UI::Dialog::CloneTiler *get_clone_tiler_panel(SPDesktop *desktop)
  98. @@ -152,11 +161,7 @@
  99. int mode = ege_select_one_action_get_active( act );
  100. Inkscape::Preferences *prefs = Inkscape::Preferences::get();
  101. prefs->setInt("/tools/spray/mode", mode);
  102. - if(mode != 3){
  103. - sp_spray_erase_sensitivize(tbl, true);
  104. - } else {
  105. - sp_spray_erase_sensitivize(tbl, false);
  106. - }
  107. + sp_spray_init(tbl);
  108. }
  109. static void sp_spray_population_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
  110. @@ -193,7 +198,7 @@
  111. gboolean active = gtk_toggle_action_get_active(act);
  112. prefs->setBool("/tools/spray/no_overlap", active);
  113. GObject *tbl = G_OBJECT(data);
  114. - sp_stb_sensitivize(tbl);
  115. + sp_stb_update_widgets(tbl);
  116. }
  117. static void sp_toggle_pressure_scale( GtkToggleAction* act, gpointer data)
  118. @@ -205,7 +210,7 @@
  119. prefs->setDouble("/tools/spray/scale_variation", 0);
  120. }
  121. GObject *tbl = G_OBJECT(data);
  122. - sp_stb_sensitivize( tbl );
  123. + sp_stb_update_widgets( tbl );
  124. }
  125. static void sp_toggle_over_no_transparent( GtkToggleAction* act, gpointer data)
  126. @@ -237,7 +242,7 @@
  127. }
  128. }
  129. GObject *tbl = G_OBJECT(data);
  130. - sp_stb_sensitivize(tbl);
  131. + sp_stb_update_widgets(tbl);
  132. }
  133. static void sp_toggle_pick_center( GtkToggleAction* act, gpointer data )
  134. @@ -286,13 +291,13 @@
  135. EgeAdjustmentAction *eact = create_adjustment_action( "SprayWidthAction",
  136. _("Width"), _("Width:"), _("The width of the spray area (relative to the visible canvas area)"),
  137. "/tools/spray/width", 15,
  138. - GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-spray",
  139. + GTK_WIDGET(desktop->canvas), holder, true, "altx-spray",
  140. 1, 100, 1.0, 10.0,
  141. labels, values, G_N_ELEMENTS(labels),
  142. sp_spray_width_value_changed, NULL /*unit tracker*/, 1, 0 );
  143. ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
  144. gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
  145. - gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
  146. + gtk_action_set_sensitive( GTK_ACTION(eact), true );
  147. }
  148. /* Use Pressure Width button */
  149. @@ -315,13 +320,13 @@
  150. EgeAdjustmentAction *eact = create_adjustment_action( "SprayMeanAction",
  151. _("Focus"), _("Focus:"), _("0 to spray a spot; increase to enlarge the ring radius"),
  152. "/tools/spray/mean", 0,
  153. - GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-mean",
  154. + GTK_WIDGET(desktop->canvas), holder, true, "spray-mean",
  155. 0, 100, 1.0, 10.0,
  156. labels, values, G_N_ELEMENTS(labels),
  157. sp_spray_mean_value_changed, NULL /*unit tracker*/, 1, 0 );
  158. ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
  159. gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
  160. - gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
  161. + gtk_action_set_sensitive( GTK_ACTION(eact), true );
  162. }
  163. {
  164. @@ -331,13 +336,13 @@
  165. EgeAdjustmentAction *eact = create_adjustment_action( "SprayStandard_deviationAction",
  166. C_("Spray tool", "Scatter"), C_("Spray tool", "Scatter:"), _("Increase to scatter sprayed objects"),
  167. "/tools/spray/standard_deviation", 70,
  168. - GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-standard_deviation",
  169. + GTK_WIDGET(desktop->canvas), holder, true, "spray-standard_deviation",
  170. 1, 100, 1.0, 10.0,
  171. labels, values, G_N_ELEMENTS(labels),
  172. sp_spray_standard_deviation_value_changed, NULL /*unit tracker*/, 1, 0 );
  173. ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
  174. gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
  175. - gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
  176. + gtk_action_set_sensitive( GTK_ACTION(eact), true );
  177. }
  178. /* Mode */
  179. @@ -401,13 +406,13 @@
  180. _("Amount"), _("Amount:"),
  181. _("Adjusts the number of items sprayed per click"),
  182. "/tools/spray/population", 70,
  183. - GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-population",
  184. + GTK_WIDGET(desktop->canvas), holder, true, "spray-population",
  185. 1, 100, 1.0, 10.0,
  186. labels, values, G_N_ELEMENTS(labels),
  187. sp_spray_population_value_changed, NULL /*unit tracker*/, 1, 0 );
  188. ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
  189. gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
  190. - gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
  191. + gtk_action_set_sensitive( GTK_ACTION(eact), true );
  192. g_object_set_data( holder, "spray_population", eact );
  193. }
  194. @@ -432,13 +437,13 @@
  195. // xgettext:no-c-format
  196. _("Variation of the rotation of the sprayed objects; 0% for the same rotation than the original object"),
  197. "/tools/spray/rotation_variation", 0,
  198. - GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-rotation",
  199. + GTK_WIDGET(desktop->canvas), holder, true, "spray-rotation",
  200. 0, 100, 1.0, 10.0,
  201. labels, values, G_N_ELEMENTS(labels),
  202. sp_spray_rotation_value_changed, NULL /*unit tracker*/, 1, 0 );
  203. ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
  204. gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
  205. - gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
  206. + gtk_action_set_sensitive( GTK_ACTION(eact), true );
  207. g_object_set_data( holder, "spray_rotation", eact );
  208. }
  209. @@ -450,13 +455,13 @@
  210. // xgettext:no-c-format
  211. _("Variation in the scale of the sprayed objects; 0% for the same scale than the original object"),
  212. "/tools/spray/scale_variation", 0,
  213. - GTK_WIDGET(desktop->canvas), holder, TRUE, "spray-scale",
  214. + GTK_WIDGET(desktop->canvas), holder, true, "spray-scale",
  215. 0, 100, 1.0, 10.0,
  216. labels, values, G_N_ELEMENTS(labels),
  217. sp_spray_scale_value_changed, NULL /*unit tracker*/, 1, 0 );
  218. ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
  219. gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
  220. - gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
  221. + gtk_action_set_sensitive( GTK_ACTION(eact), true );
  222. g_object_set_data( holder, "spray_scale", eact );
  223. }
  224. @@ -605,7 +610,7 @@
  225. g_object_set_data( holder, "offset", eact );
  226. gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
  227. }
  228. - sp_spray_erase_sensitivize(holder, prefs->getInt("/tools/spray/mode") != 3);
  229. + sp_spray_init(holder);
  230. }
  231. === modified file 'src/widgets/toolbox.cpp'
  232. --- src/widgets/toolbox.cpp 2015-12-07 20:18:04 +0000
  233. +++ src/widgets/toolbox.cpp 2016-01-25 13:53:06 +0000
  234. @@ -1468,7 +1468,7 @@
  235. #endif
  236. }
  237. - gtk_widget_show_all( holder );
  238. + gtk_widget_show_now( holder );
  239. sp_set_font_size_smaller( holder );
  240. gtk_size_group_add_widget( grouper, holder );
  241. @@ -1489,7 +1489,7 @@
  242. for (int i = 0 ; aux_toolboxes[i].type_name ; i++ ) {
  243. GtkWidget *sub_toolbox = GTK_WIDGET(g_object_get_data(G_OBJECT(toolbox), aux_toolboxes[i].data_name));
  244. if (tname && !strcmp(tname, aux_toolboxes[i].type_name)) {
  245. - gtk_widget_show_all(sub_toolbox);
  246. + gtk_widget_show_now(sub_toolbox);
  247. g_object_set_data(G_OBJECT(toolbox), "shows", sub_toolbox);
  248. } else {
  249. gtk_widget_hide(sub_toolbox);
 
 

63

 

935

Pasted Text #1091

-

PasteBin

行数
267
词数
1168
文件大小
15.8 KB
创建于
类型
text/plain
Public Domain (PD)
登录后发言!