diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2009-01-14 19:02:22 -0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2009-01-14 19:02:22 -0200 |
commit | 038f559845ac8b8b45f5a53537b011e169d45f59 (patch) | |
tree | 5403751e67ea55365f3caf7a1f65dfbb0869d465 | |
parent | cc62903f999ba0c5076861888106365e3561f775 (diff) |
Xgc now in Technicolor
Added a simple Xgc-color resources file.
Corrected a bug that would prevent it from showing 100 in percent
label, due to using a buffer of 3 bytes.
Hardcode "test area" foreground&background to black&white.
Remove a few hardcoded resource values to better work with the new
resources file (some settings may require moving data from Xgc-color
to Xgc, if you don't have a color display).
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | app-defaults/Xgc-color | 55 | ||||
-rw-r--r-- | main.c | 20 | ||||
-rw-r--r-- | testfrac.c | 5 | ||||
-rw-r--r-- | text.c | 7 |
5 files changed, 68 insertions, 23 deletions
diff --git a/Makefile.am b/Makefile.am index 55a7ec4..c8d5a04 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,8 +57,8 @@ DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults appdefaultdir = @appdefaultdir@ dist_appdefault_DATA = \ - app-defaults/Xgc - + app-defaults/Xgc \ + app-defaults/Xgc-color EXTRA_DIST = tile Bugs \ Written/FilledRects \ diff --git a/app-defaults/Xgc-color b/app-defaults/Xgc-color new file mode 100644 index 0000000..e70d869 --- /dev/null +++ b/app-defaults/Xgc-color @@ -0,0 +1,55 @@ +*Foreground: rgb:2/3/1 +*Background: rgb:c/d/b +*BorderWidth: 0 + +*Label.justify: left +*Text.Background: rgb:d/e/c +*Text.displayList: foreground rgb:f/f/d;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:7/7/5;segments -2,0,1,0, 0,1,0,-2 +*Form.displayList: foreground rgb:7/7/5;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:f/f/d;segments -2,0,1,0, 0,1,0,-2 + +*Label.width: 130 +*Label.left: chainLeft +*Label.right: chainLeft +*topform.Form.displayList: foreground rgb:e/e/e;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:4/4/4;segments -2,0,1,0, 0,1,0,-2 +*topform.Form.Form.displayList: + +*topform.Form.linestyle.Toggle.width: 123 +*topform.Form.capstyle.Toggle.width: 185 +*topform.Form.joinstyle.Toggle.width: 123 +*topform.Form.fillstyle.Toggle.width: 185 +*topform.Form.fillrule.Toggle.width: 185 +*topform.Form.arcmode.Toggle.width: 185 +*topform.Form.linewidth.Text.width: 372 +*topform.Form.font.Text.width: 372 +*topform.Form.foreground.Text.width: 110 +*topform.Form.background.Text.width: 110 +*topform.Form.testpercent.100.Background: rgb:b/c/a +*topform.Form.testpercent.100.displayList: foreground rgb:e/e/c;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:5/5/3;segments -2,0,1,0, 0,1,0,-2 +*topform.Form.testpercent.100.justify:right +*topform.Form.testpercent.100.width: 30 +*topform.Form.testpercent.100.left: chainLeft +*topform.Form.testpercent.100.right: chainRight +*topform.Form.testpercent.100.borderWidth: 0 +*topform.Form.testpercent.Scrollbar.width: 332 +*topform.Form.testpercent.Scrollbar.displayList: foreground rgb:e/e/c;segments 1,-1,-2,-1, -1,-2,-1,1;foreground rgb:5/5/3;segments -2,0,1,0, 0,1,0,-2 + +*topform.Form.testpercent.Scrollbar.Background: rgb:b/c/a + +*Toggle.borderWidth: 1 +*Toggle.borderColor: rgb:6/8/6 +*Toggle.justify: left +*Toggle.foreground: rgb:2/4/2 +*Toggle.background: rgb:8/a/8 +*Toggle.highlightThickness: 0 +*Toggle.displayList: foreground rgb:4/6/4;draw-rect 1,1,-2,-2;foreground rgb:8/a/8;draw-rect 0,0,-1,-1 + +*Command.width: 102 +*Command.borderWidth: 1 +*Command.borderColor: rgb:a/8/6 +*Command.justify: left +*Command.foreground: rgb:6/6/2 +*Command.background: rgb:c/c/8 +*Command.highlightThickness: 2 +*Command.displayList: line-style solid;foreground rgb:8/8/4;draw-rect 1,1,-2,-2;dashes 2,2;line-style onoffdash;foreground rgb:c/c/8;draw-rect 0,0,-1,-1 + +*test.BorderWidth: 1 @@ -371,12 +371,14 @@ main(int argc, char *argv[]) gcchoiceargs[0].value = (XtArgVal) fontchoice; foregroundchoice = XtCreateManagedWidget("foreground",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); - foregroundtext = create_text_choice(foregroundchoice,TForeground,4,50); + foregroundtext = create_text_choice(foregroundchoice,TForeground,9,50); + /* FIXME 9 characters may not be the proper choice; really it + * should understand a more proper pixel specification... */ gcchoiceargs[1].value = (XtArgVal) foregroundchoice; backgroundchoice = XtCreateManagedWidget("background",formWidgetClass,GCform, gcchoiceargs,XtNumber(gcchoiceargs)); - backgroundtext = create_text_choice(backgroundchoice,TBackground,4,50); + backgroundtext = create_text_choice(backgroundchoice,TBackground,9,50); gcchoiceargs[1].value = (XtArgVal) NULL; gcchoiceargs[0].value = (XtArgVal) foregroundchoice; @@ -607,18 +609,8 @@ clear_result_window(void) static void set_foreground_and_background(void) { - static XtResource resources[] = { - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - XtOffsetOf(XStuff, foreground), XtRString, XtDefaultForeground}, - {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), - XtOffsetOf(XStuff, background), XtRString, XtDefaultBackground} - }; - - XtGetApplicationResources(bigdaddy, (XtPointer) &X, resources, - XtNumber(resources), NULL, (Cardinal) 0); - - X.gcv.foreground = X.foreground; - X.gcv.background = X.background; + X.gcv.foreground = X.foreground = 0; + X.gcv.background = X.background = 0xffffffff; X.fontname = "6x10"; GC_change_font(X.fontname,FALSE); @@ -43,7 +43,7 @@ slider_jump(Widget w, caddr_t data, caddr_t position) float oldpercent; /* where the scrollbar is */ float newpercent; /* normalized scrollbar */ - char snewpercent[3]; /* string representation of scrollbar */ + char snewpercent[4]; /* string representation of scrollbar */ oldpercent = *(float *) position; @@ -131,7 +131,6 @@ create_testfrac_choice(Widget w) }; static Arg percentargs[] = { - {XtNborderWidth, (XtArgVal) 1}, {XtNhorizDistance, (XtArgVal) 10}, {XtNfromHoriz, (XtArgVal) NULL} }; @@ -162,7 +161,7 @@ create_testfrac_choice(Widget w) label = XtCreateManagedWidget("Percentage of Test",labelWidgetClass,w, labelargs,XtNumber(labelargs)); - percentargs[2].value = (XtArgVal) label; + percentargs[1].value = (XtArgVal) label; percent = XtCreateManagedWidget("100",labelWidgetClass,w, percentargs,XtNumber(percentargs)); @@ -66,7 +66,6 @@ create_text_choice(Widget w, int type, int length, int width) {XtNeditType, (XtArgVal) XawtextEdit}, {XtNstring, (XtArgVal) NULL}, {XtNlength, (XtArgVal) NULL}, - {XtNwidth, (XtArgVal) NULL}, {XtNhorizDistance, (XtArgVal) 10}, {XtNfromHoriz, (XtArgVal) NULL}, {XtNinsertPosition, (XtArgVal) NULL}, @@ -83,6 +82,7 @@ create_text_choice(Widget w, int type, int length, int width) snprintf(translationtable,sizeof translationtable, "<Leave>: WriteText(%d)\n\ + <Btn1Down>: set-keyboard-focus() select-start()\n\ Ctrl<Key>J: Nothing()\n\ Ctrl<Key>M: Nothing()\n\ <Key>Linefeed: Nothing()\n\ @@ -120,9 +120,8 @@ create_text_choice(Widget w, int type, int length, int width) } textargs[1].value = (XtArgVal) textstrings[type]; textargs[2].value = (XtArgVal) length; - textargs[3].value = (XtArgVal) width; - textargs[5].value = (XtArgVal) label; - textargs[6].value = (XtArgVal) strlen(textstrings[type]); + textargs[4].value = (XtArgVal) label; + textargs[5].value = (XtArgVal) strlen(textstrings[type]); text = XtCreateManagedWidget("text", asciiTextWidgetClass,w, textargs,XtNumber(textargs)); |