Commit request: Widgets now respect grey property on Linux gtk


Subject: Commit request: Widgets now respect grey property on Linux gtk
From: Bryce Nesbitt (bryce@obviously.com)
Date: Fri Dec 14 2001 - 10:48:12 CST


Would someone look this over and if ok commit? Two widget types -- submenu headers and
the ColorFore/ColorBack icons -- did not properly respect the disabled or "grey" property.

Testing of this under other platforms would be nice also. I can only address Linux gtk
and the platform independent portions.

                -Bryce

Notes: "Style locking" was the first time these widgets had ever been asked to become grey.
Test it by editing an xml document to add <abiword styles="locked">.

Index: src/af/ev/unix/ev_UnixMenu.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/ev/unix/ev_UnixMenu.cpp,v
retrieving revision 1.72
diff -u -r1.72 ev_UnixMenu.cpp
--- src/af/ev/unix/ev_UnixMenu.cpp 2001/10/26 03:59:47 1.72
+++ src/af/ev/unix/ev_UnixMenu.cpp 2001/12/14 16:34:17
@@ -1021,6 +1021,16 @@
                         GtkWidget * item = (GtkWidget *) m_vecMenuWidgets.getNthItem(k);
                         UT_ASSERT(item);
 
+ bool bEnable = true;
+ if (pAction->hasGetStateFunction())
+ {
+ EV_Menu_ItemState mis = pAction->getMenuItemState(pView);
+ if (mis & EV_MIS_Gray)
+ bEnable = false;
+ }
+ gtk_widget_set_sensitive((GtkWidget *) item, bEnable);
+
+ // must have an entry for each and every layout item in the vector
                         stack.push(item);
                         break;
                 }
Index: src/af/ev/unix/ev_UnixToolbar.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/ev/unix/ev_UnixToolbar.cpp,v
retrieving revision 1.73
diff -u -r1.73 ev_UnixToolbar.cpp
--- src/af/ev/unix/ev_UnixToolbar.cpp 2001/12/10 15:02:08 1.73
+++ src/af/ev/unix/ev_UnixToolbar.cpp 2001/12/14 16:34:19
@@ -916,6 +916,20 @@
                                 }
                                 break;
 
+ // :TODO: This code seems to have no effect. It should grey out the widgets!
+ case EV_TBIT_ColorFore:
+ case EV_TBIT_ColorBack:
+ {
+ bool bGrayed = EV_TIS_ShouldBeGray(tis);
+
+ _wd * wd = (_wd *) m_vecToolbarWidgets.getNthItem(k);
+ UT_ASSERT(wd);
+ GtkCombo * item = GTK_COMBO(wd->m_widget);
+ UT_ASSERT(item);
+ gtk_widget_set_sensitive(GTK_WIDGET(item), !bGrayed); // Disable/enable toolbar item
+ }
+ break;
+
                                 case EV_TBIT_StaticLabel:
                                         break;
                                 case EV_TBIT_Spacer:
Index: src/wp/ap/xp/ap_Menu_Functions.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Functions.cpp,v
retrieving revision 1.52
diff -u -r1.52 ap_Menu_Functions.cpp
--- src/wp/ap/xp/ap_Menu_Functions.cpp 2001/12/10 16:00:53 1.52
+++ src/wp/ap/xp/ap_Menu_Functions.cpp 2001/12/14 16:34:23
@@ -623,9 +623,13 @@
         const XML_Char * prop = NULL;
         const XML_Char * val = NULL;
 
- if(pView->getDocument()->areStylesLocked()) {
- return EV_MIS_Gray;
- }
+// For now, simple character attributes are allowed, even if styles are locked.
+// This may change if it becomes easier to apply the same attributes within
+// the styles metaphor.
+//
+// if(pView->getDocument()->areStylesLocked()) {
+// return EV_MIS_Gray;
+// }
 
         switch(id)
         {
Index: src/wp/ap/xp/ap_Toolbar_ActionSet.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Toolbar_ActionSet.cpp,v
retrieving revision 1.37
diff -u -r1.37 ap_Toolbar_ActionSet.cpp
--- src/wp/ap/xp/ap_Toolbar_ActionSet.cpp 2001/12/10 16:00:53 1.37
+++ src/wp/ap/xp/ap_Toolbar_ActionSet.cpp 2001/12/14 16:34:24
@@ -79,8 +79,9 @@
         _s(AP_TOOLBAR_ID_SPELLCHECK, EV_TBIT_PushButton, "dlgSpell", AV_CHG_NONE, NULL);
         _s(AP_TOOLBAR_ID_IMG, EV_TBIT_PushButton, "fileInsertGraphic", AV_CHG_NONE, NULL);
         _s(AP_TOOLBAR_ID_HELP, EV_TBIT_PushButton, "helpContents", AV_CHG_NONE, NULL);
- _s(AP_TOOLBAR_ID_COLOR_FORE, EV_TBIT_ColorFore, "colorForeTB", AV_CHG_NONE, ap_ToolbarGetState_StylesLocked);
- _s(AP_TOOLBAR_ID_COLOR_BACK, EV_TBIT_ColorBack, "colorBackTB", AV_CHG_NONE, ap_ToolbarGetState_StylesLocked);
+ // AV_CHG_FMTBLOCK, below, doesn't seem right. TODO. This changes as a document property only.
+ _s(AP_TOOLBAR_ID_COLOR_FORE, EV_TBIT_ColorFore, "colorForeTB", AV_CHG_FMTBLOCK, ap_ToolbarGetState_StylesLocked);
+ _s(AP_TOOLBAR_ID_COLOR_BACK, EV_TBIT_ColorBack, "colorBackTB", AV_CHG_ALL, ap_ToolbarGetState_StylesLocked);
         _s(AP_TOOLBAR_ID_EDIT_UNDO, EV_TBIT_PushButton, "undo", AV_CHG_DO, ap_ToolbarGetState_Changes);
         _s(AP_TOOLBAR_ID_EDIT_REDO, EV_TBIT_PushButton, "redo", AV_CHG_DO, ap_ToolbarGetState_Changes);
         _s(AP_TOOLBAR_ID_EDIT_CUT, EV_TBIT_PushButton, "cut", AV_CHG_EMPTYSEL, ap_ToolbarGetState_Selection);
Index: src/wp/ap/xp/ap_Toolbar_Functions.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Toolbar_Functions.cpp,v
retrieving revision 1.40
diff -u -r1.40 ap_Toolbar_Functions.cpp
--- src/wp/ap/xp/ap_Toolbar_Functions.cpp 2001/12/10 16:00:53 1.40
+++ src/wp/ap/xp/ap_Toolbar_Functions.cpp 2001/12/14 16:34:24
@@ -255,9 +255,13 @@
 
         EV_Toolbar_ItemState s = EV_TIS_ZERO;
 
- if(pView->getDocument()->areStylesLocked()) {
- return EV_TIS_Gray;
- }
+// For now, simple character attributes are allowed, even if styles are locked.
+// This may change if it becomes easier to apply the same attributes within
+// the styles metaphor.
+//
+// if(pView->getDocument()->areStylesLocked()) {
+// return EV_TIS_Gray;
+// }
 
         switch (id)
         {



This archive was generated by hypermail 2b25 : Fri Dec 14 2001 - 10:50:17 CST