add widgets to let you set the moveresize popup's fixed position
authorDana Jansens <danakj@orodu.net>
Sat, 12 Jan 2008 18:36:01 +0000 (13:36 -0500)
committerDana Jansens <danakj@orodu.net>
Sat, 12 Jan 2008 18:36:01 +0000 (13:36 -0500)
src/moveresize.c
src/obconf.glade
src/strings.c

index fe69ed5..3c9bade 100644 (file)
@@ -28,8 +28,14 @@ static gboolean mapping = FALSE;
 
 #define POSITION_CENTER 0
 #define POSITION_TOP    1
+#define POSITION_FIXED  2
+
+#define EDGE_CENTER 0
+#define EDGE_LEFT   1
+#define EDGE_RIGHT  2
 
 static void enable_stuff();
+static void write_fixed_position(const gchar *coord);
 
 void moveresize_setup_tab()
 {
@@ -83,11 +89,20 @@ void moveresize_setup_tab()
 
     w = get_widget("resize_position");
     s = tree_get_string("resize/popupPosition", "Center");
-    if (!strcasecmp(s, "Top")) pos = POSITION_TOP;
-    else                       pos = POSITION_CENTER;
+    if (!strcasecmp(s, "Top"))   pos = POSITION_TOP;
+    if (!strcasecmp(s, "Fixed")) pos = POSITION_FIXED;
+    else                         pos = POSITION_CENTER;
     g_free(s);
     gtk_option_menu_set_history(GTK_OPTION_MENU(w), pos);
 
+    w = get_widget("fixed_x_pos");
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
+                              tree_get_int("resize/popupFixedPosition/x", 0));
+
+    w = get_widget("fixed_y_pos");
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
+                              tree_get_int("resize/popupFixedPosition/y", 0));
+
     i = tree_get_int("mouse/screenEdgeWarpTime", 400);
 
     w = get_widget("warp_edge");
@@ -115,6 +130,30 @@ static void enable_stuff()
     b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
     w = get_widget("warp_edge_time");
     gtk_widget_set_sensitive(w, b);
+
+    w = get_widget("resize_position");
+    b = gtk_option_menu_get_history(GTK_OPTION_MENU(w)) == POSITION_FIXED;
+    w = get_widget("fixed_x_popup");
+    gtk_widget_set_sensitive(w, b);
+    w = get_widget("fixed_y_popup");
+    gtk_widget_set_sensitive(w, b);
+    if (!b) {
+        w = get_widget("fixed_x_pos");
+        gtk_widget_set_sensitive(w, FALSE);
+        w = get_widget("fixed_y_pos");
+        gtk_widget_set_sensitive(w, FALSE);
+    }
+    else {
+        w = get_widget("fixed_x_popup");
+        b = gtk_option_menu_get_history(GTK_OPTION_MENU(w)) != EDGE_CENTER;
+        w = get_widget("fixed_x_pos");
+        gtk_widget_set_sensitive(w, b);
+
+        w = get_widget("fixed_y_popup");
+        b = gtk_option_menu_get_history(GTK_OPTION_MENU(w)) != EDGE_CENTER;
+        w = get_widget("fixed_y_pos");
+        gtk_widget_set_sensitive(w, b);
+    }
 }
 
 void on_resist_window_value_changed(GtkSpinButton *w, gpointer data)
@@ -179,7 +218,6 @@ void on_resize_position_center_activate(GtkMenuItem *w, gpointer data)
     enable_stuff();
 }
 
-
 void on_resize_position_top_activate(GtkMenuItem *w, gpointer data)
 {
     if (mapping) return;
@@ -188,6 +226,119 @@ void on_resize_position_top_activate(GtkMenuItem *w, gpointer data)
     enable_stuff();
 }
 
+void on_resize_position_fixed_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_string("resize/popupPosition", "Fixed");
+    enable_stuff();
+}
+
+static void write_fixed_position(const gchar *coord)
+{
+    GtkWidget *popup;
+    gchar *popupname;
+    gchar *val;
+    gchar *valname;
+    gint edge;
+
+    g_assert(!strcmp(coord, "x") || !strcmp(coord, "y"));
+
+    popupname = g_strdup_printf("fixed_%s_popup", coord);
+    popup = get_widget(popupname);
+    g_free(popupname);
+
+    edge = gtk_option_menu_get_history(GTK_OPTION_MENU(popup));
+    g_assert(edge == EDGE_CENTER || edge == EDGE_LEFT || edge == EDGE_RIGHT);
+
+    if (edge == EDGE_CENTER)
+        val = g_strdup("center");
+    else {
+        GtkWidget *spin;
+        gchar *spinname;
+        gint i;
+
+        spinname = g_strdup_printf("fixed_%s_pos", coord);
+        spin = get_widget(spinname);
+        g_free(spinname);
+
+        i = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
+
+        if (edge == EDGE_LEFT)
+            val = g_strdup_printf("%d", i);
+        else
+            val = g_strdup_printf("-%d", i);
+    }
+
+    valname = g_strdup_printf("resize/popupFixedPosition/%s", coord);
+    tree_set_string(valname, val);
+    g_free(valname);
+    g_free(val);
+}
+
+
+void on_fixed_x_position_left_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("x");
+    enable_stuff();
+}
+
+void on_fixed_x_position_right_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("x");
+    enable_stuff();
+}
+
+void on_fixed_x_position_center_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("x");
+    enable_stuff();
+}
+
+void on_fixed_y_position_left_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("y");
+    enable_stuff();
+}
+
+void on_fixed_y_position_right_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("y");
+    enable_stuff();
+}
+
+void on_fixed_y_position_center_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("y");
+    enable_stuff();
+}
+
+void on_fixed_x_pos_value_changed(GtkSpinButton *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("x");
+}
+
+void on_fixed_y_pos_value_changed(GtkSpinButton *w, gpointer data)
+{
+    if (mapping) return;
+
+    write_fixed_position("y");
+}
+
 void on_warp_edge_toggled(GtkToggleButton *w, gpointer data)
 {
     if (mapping) return;
index 1a7ace1..1be0f97 100644 (file)
@@ -34,7 +34,7 @@
          <property name="show_tabs">True</property>
          <property name="show_border">True</property>
          <property name="tab_pos">GTK_POS_LEFT</property>
-         <property name="scrollable">False</property>
+         <property name="scrollable">True</property>
          <property name="enable_popup">False</property>
 
          <child>
@@ -2165,19 +2165,338 @@ C - The close button</property>
                              </child>
 
                              <child>
-                               <placeholder/>
-                             </child>
+                               <widget class="GtkHBox" id="hbox109">
+                                 <property name="visible">True</property>
+                                 <property name="homogeneous">False</property>
+                                 <property name="spacing">0</property>
 
-                             <child>
-                               <placeholder/>
-                             </child>
+                                 <child>
+                                   <widget class="GtkLabel" id="label223">
+                                     <property name="visible">True</property>
+                                     <property name="label">    </property>
+                                     <property name="use_underline">False</property>
+                                     <property name="use_markup">False</property>
+                                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                     <property name="wrap">False</property>
+                                     <property name="selectable">False</property>
+                                     <property name="xalign">0.5</property>
+                                     <property name="yalign">0.5</property>
+                                     <property name="xpad">0</property>
+                                     <property name="ypad">0</property>
+                                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                     <property name="width_chars">-1</property>
+                                     <property name="single_line_mode">False</property>
+                                     <property name="angle">0</property>
+                                   </widget>
+                                   <packing>
+                                     <property name="padding">0</property>
+                                     <property name="expand">False</property>
+                                     <property name="fill">False</property>
+                                   </packing>
+                                 </child>
 
-                             <child>
-                               <placeholder/>
-                             </child>
+                                 <child>
+                                   <widget class="GtkVBox" id="vbox82">
+                                     <property name="visible">True</property>
+                                     <property name="homogeneous">False</property>
+                                     <property name="spacing">6</property>
 
-                             <child>
-                               <placeholder/>
+                                     <child>
+                                       <widget class="GtkHBox" id="hbox110">
+                                         <property name="visible">True</property>
+                                         <property name="homogeneous">False</property>
+                                         <property name="spacing">12</property>
+
+                                         <child>
+                                           <widget class="GtkLabel" id="label224">
+                                             <property name="visible">True</property>
+                                             <property name="label" translatable="yes">Fixed _x position:</property>
+                                             <property name="use_underline">True</property>
+                                             <property name="use_markup">False</property>
+                                             <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                             <property name="wrap">False</property>
+                                             <property name="selectable">False</property>
+                                             <property name="xalign">0</property>
+                                             <property name="yalign">0.5</property>
+                                             <property name="xpad">0</property>
+                                             <property name="ypad">0</property>
+                                             <property name="mnemonic_widget">fixed_x_popup</property>
+                                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                             <property name="width_chars">-1</property>
+                                             <property name="single_line_mode">False</property>
+                                             <property name="angle">0</property>
+                                           </widget>
+                                           <packing>
+                                             <property name="padding">0</property>
+                                             <property name="expand">False</property>
+                                             <property name="fill">False</property>
+                                           </packing>
+                                         </child>
+
+                                         <child>
+                                           <widget class="GtkOptionMenu" id="fixed_x_popup">
+                                             <property name="visible">True</property>
+                                             <property name="can_focus">True</property>
+                                             <property name="history">0</property>
+
+                                             <child>
+                                               <widget class="GtkMenu" id="menu14">
+
+                                                 <child>
+                                                   <widget class="GtkMenuItem" id="menuitem3">
+                                                     <property name="visible">True</property>
+                                                     <property name="label" translatable="yes">Centered</property>
+                                                     <property name="use_underline">True</property>
+                                                     <signal name="activate" handler="on_fixed_x_position_center_activate" last_modification_time="Sat, 12 Jan 2008 17:54:15 GMT"/>
+                                                   </widget>
+                                                 </child>
+
+                                                 <child>
+                                                   <widget class="GtkMenuItem" id="from_left_edge1">
+                                                     <property name="visible">True</property>
+                                                     <property name="label" translatable="yes">From left edge</property>
+                                                     <property name="use_underline">True</property>
+                                                     <signal name="activate" handler="on_fixed_x_position_left_activate" last_modification_time="Sat, 12 Jan 2008 17:54:15 GMT"/>
+                                                   </widget>
+                                                 </child>
+
+                                                 <child>
+                                                   <widget class="GtkMenuItem" id="from_right_edge1">
+                                                     <property name="visible">True</property>
+                                                     <property name="label" translatable="yes">From right edge</property>
+                                                     <property name="use_underline">True</property>
+                                                     <signal name="activate" handler="on_fixed_x_position_right_activate" last_modification_time="Sat, 12 Jan 2008 17:54:15 GMT"/>
+                                                   </widget>
+                                                 </child>
+                                               </widget>
+                                             </child>
+                                           </widget>
+                                           <packing>
+                                             <property name="padding">0</property>
+                                             <property name="expand">False</property>
+                                             <property name="fill">False</property>
+                                           </packing>
+                                         </child>
+
+                                         <child>
+                                           <widget class="GtkHBox" id="hbox112">
+                                             <property name="visible">True</property>
+                                             <property name="homogeneous">False</property>
+                                             <property name="spacing">6</property>
+
+                                             <child>
+                                               <widget class="GtkSpinButton" id="fixed_x_pos">
+                                                 <property name="visible">True</property>
+                                                 <property name="can_focus">True</property>
+                                                 <property name="climb_rate">1</property>
+                                                 <property name="digits">0</property>
+                                                 <property name="numeric">True</property>
+                                                 <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                                                 <property name="snap_to_ticks">False</property>
+                                                 <property name="wrap">False</property>
+                                                 <property name="adjustment">1 0 1000 1 10 10</property>
+                                                 <signal name="value_changed" handler="on_fixed_x_pos_value_changed" after="yes" last_modification_time="Sat, 12 Jan 2008 18:21:45 GMT"/>
+                                               </widget>
+                                               <packing>
+                                                 <property name="padding">0</property>
+                                                 <property name="expand">False</property>
+                                                 <property name="fill">True</property>
+                                               </packing>
+                                             </child>
+
+                                             <child>
+                                               <widget class="GtkLabel" id="label227">
+                                                 <property name="visible">True</property>
+                                                 <property name="label" translatable="yes">px</property>
+                                                 <property name="use_underline">False</property>
+                                                 <property name="use_markup">False</property>
+                                                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                                 <property name="wrap">False</property>
+                                                 <property name="selectable">False</property>
+                                                 <property name="xalign">0.5</property>
+                                                 <property name="yalign">0.5</property>
+                                                 <property name="xpad">0</property>
+                                                 <property name="ypad">0</property>
+                                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                                 <property name="width_chars">-1</property>
+                                                 <property name="single_line_mode">False</property>
+                                                 <property name="angle">0</property>
+                                               </widget>
+                                               <packing>
+                                                 <property name="padding">0</property>
+                                                 <property name="expand">False</property>
+                                                 <property name="fill">False</property>
+                                               </packing>
+                                             </child>
+                                           </widget>
+                                           <packing>
+                                             <property name="padding">0</property>
+                                             <property name="expand">True</property>
+                                             <property name="fill">True</property>
+                                           </packing>
+                                         </child>
+                                       </widget>
+                                       <packing>
+                                         <property name="padding">0</property>
+                                         <property name="expand">True</property>
+                                         <property name="fill">True</property>
+                                       </packing>
+                                     </child>
+
+                                     <child>
+                                       <widget class="GtkHBox" id="hbox111">
+                                         <property name="visible">True</property>
+                                         <property name="homogeneous">False</property>
+                                         <property name="spacing">12</property>
+
+                                         <child>
+                                           <widget class="GtkLabel" id="label225">
+                                             <property name="visible">True</property>
+                                             <property name="label" translatable="yes">Fixed _y position:</property>
+                                             <property name="use_underline">True</property>
+                                             <property name="use_markup">False</property>
+                                             <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                             <property name="wrap">False</property>
+                                             <property name="selectable">False</property>
+                                             <property name="xalign">0</property>
+                                             <property name="yalign">0.5</property>
+                                             <property name="xpad">0</property>
+                                             <property name="ypad">0</property>
+                                             <property name="mnemonic_widget">fixed_y_popup</property>
+                                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                             <property name="width_chars">-1</property>
+                                             <property name="single_line_mode">False</property>
+                                             <property name="angle">0</property>
+                                           </widget>
+                                           <packing>
+                                             <property name="padding">0</property>
+                                             <property name="expand">False</property>
+                                             <property name="fill">False</property>
+                                           </packing>
+                                         </child>
+
+                                         <child>
+                                           <widget class="GtkOptionMenu" id="fixed_y_popup">
+                                             <property name="visible">True</property>
+                                             <property name="can_focus">True</property>
+                                             <property name="history">0</property>
+
+                                             <child>
+                                               <widget class="GtkMenu" id="menu15">
+
+                                                 <child>
+                                                   <widget class="GtkMenuItem" id="menuitem5">
+                                                     <property name="visible">True</property>
+                                                     <property name="label" translatable="yes">Centered</property>
+                                                     <property name="use_underline">True</property>
+                                                     <signal name="activate" handler="on_fixed_y_position_center_activate" last_modification_time="Sat, 12 Jan 2008 17:54:45 GMT"/>
+                                                   </widget>
+                                                 </child>
+
+                                                 <child>
+                                                   <widget class="GtkMenuItem" id="menuitem6">
+                                                     <property name="visible">True</property>
+                                                     <property name="label" translatable="yes">From left edge</property>
+                                                     <property name="use_underline">True</property>
+                                                     <signal name="activate" handler="on_fixed_y_position_left_activate" last_modification_time="Sat, 12 Jan 2008 17:54:45 GMT"/>
+                                                   </widget>
+                                                 </child>
+
+                                                 <child>
+                                                   <widget class="GtkMenuItem" id="menuitem7">
+                                                     <property name="visible">True</property>
+                                                     <property name="label" translatable="yes">From right edge</property>
+                                                     <property name="use_underline">True</property>
+                                                     <signal name="activate" handler="on_fixed_y_position_right_activate" last_modification_time="Sat, 12 Jan 2008 17:54:45 GMT"/>
+                                                   </widget>
+                                                 </child>
+                                               </widget>
+                                             </child>
+                                           </widget>
+                                           <packing>
+                                             <property name="padding">0</property>
+                                             <property name="expand">False</property>
+                                             <property name="fill">False</property>
+                                           </packing>
+                                         </child>
+
+                                         <child>
+                                           <widget class="GtkHBox" id="hbox113">
+                                             <property name="visible">True</property>
+                                             <property name="homogeneous">False</property>
+                                             <property name="spacing">6</property>
+
+                                             <child>
+                                               <widget class="GtkSpinButton" id="fixed_y_pos">
+                                                 <property name="visible">True</property>
+                                                 <property name="can_focus">True</property>
+                                                 <property name="climb_rate">1</property>
+                                                 <property name="digits">0</property>
+                                                 <property name="numeric">True</property>
+                                                 <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                                                 <property name="snap_to_ticks">False</property>
+                                                 <property name="wrap">False</property>
+                                                 <property name="adjustment">1 0 1000 1 10 10</property>
+                                                 <signal name="value_changed" handler="on_fixed_y_pos_value_changed" after="yes" last_modification_time="Sat, 12 Jan 2008 18:22:16 GMT"/>
+                                               </widget>
+                                               <packing>
+                                                 <property name="padding">0</property>
+                                                 <property name="expand">False</property>
+                                                 <property name="fill">True</property>
+                                               </packing>
+                                             </child>
+
+                                             <child>
+                                               <widget class="GtkLabel" id="label228">
+                                                 <property name="visible">True</property>
+                                                 <property name="label" translatable="yes">px</property>
+                                                 <property name="use_underline">False</property>
+                                                 <property name="use_markup">False</property>
+                                                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                                 <property name="wrap">False</property>
+                                                 <property name="selectable">False</property>
+                                                 <property name="xalign">0.5</property>
+                                                 <property name="yalign">0.5</property>
+                                                 <property name="xpad">0</property>
+                                                 <property name="ypad">0</property>
+                                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                                 <property name="width_chars">-1</property>
+                                                 <property name="single_line_mode">False</property>
+                                                 <property name="angle">0</property>
+                                               </widget>
+                                               <packing>
+                                                 <property name="padding">0</property>
+                                                 <property name="expand">False</property>
+                                                 <property name="fill">False</property>
+                                               </packing>
+                                             </child>
+                                           </widget>
+                                           <packing>
+                                             <property name="padding">0</property>
+                                             <property name="expand">True</property>
+                                             <property name="fill">True</property>
+                                           </packing>
+                                         </child>
+                                       </widget>
+                                       <packing>
+                                         <property name="padding">0</property>
+                                         <property name="expand">True</property>
+                                         <property name="fill">True</property>
+                                       </packing>
+                                     </child>
+                                   </widget>
+                                   <packing>
+                                     <property name="padding">0</property>
+                                     <property name="expand">True</property>
+                                     <property name="fill">True</property>
+                                   </packing>
+                                 </child>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">True</property>
+                                 <property name="fill">True</property>
+                               </packing>
                              </child>
                            </widget>
                            <packing>
index a56bdd2..4df0d97 100644 (file)
@@ -66,6 +66,17 @@ gchar *s = N_("Information _dialog's position:");
 gchar *s = N_("Centered on the window");
 gchar *s = N_("Above the window");
 gchar *s = N_("Fixed position on screen");
+gchar *s = N_("    ");
+gchar *s = N_("Fixed _x position:");
+gchar *s = N_("Centered");
+gchar *s = N_("From left edge");
+gchar *s = N_("From right edge");
+gchar *s = N_("px");
+gchar *s = N_("Fixed _y position:");
+gchar *s = N_("Centered");
+gchar *s = N_("From left edge");
+gchar *s = N_("From right edge");
+gchar *s = N_("px");
 gchar *s = N_("Move & Resize");
 gchar *s = N_("<span weight=\"bold\">Focusing Windows</span>");
 gchar *s = N_("    ");