Mercurial > dwindows
changeset 193:efd4703450fa
Build test application on Unix too... and also fixed GTK to allow
OS/2 style colors in dw_color_xxx_set().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 17 Jan 2003 23:52:44 +0000 |
parents | d946e329670c |
children | 37bee5b50bcb |
files | Makefile.in dwtest.c gtk/dw.c |
diffstat | 3 files changed, 26 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.in Fri Jan 17 23:28:28 2003 +0000 +++ b/Makefile.in Fri Jan 17 23:52:44 2003 +0000 @@ -99,3 +99,6 @@ $(SYSCONF_LINK_TARGET): $(OBJECTS) $(SYSCONF_LINK_LIB) + +dwtest: dwtest.o + $(CC) -o dwtest dwtest.o -Llib -ldw -ldwcompat $(LFLAGS)
--- a/dwtest.c Fri Jan 17 23:28:28 2003 +0000 +++ b/dwtest.c Fri Jan 17 23:52:44 2003 +0000 @@ -61,7 +61,7 @@ browsebox = dw_box_new(BOXHORZ, 0); - dw_box_pack_start(lbbox, browsebox, 130, 15, TRUE, TRUE, 0); + dw_box_pack_start(lbbox, browsebox, 0, 0, TRUE, TRUE, 0); entryfield = dw_entryfield_new("", 100L); @@ -110,7 +110,7 @@ /* Buttons */ buttonbox = dw_box_new(BOXHORZ, 10); - dw_box_pack_start(lbbox, buttonbox, 140, 210, TRUE, TRUE, 0); + dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); okbutton = dw_button_new("Ok", 1001L); @@ -149,7 +149,7 @@ void text_add(void) { - int i,x,y; + int i,y,depth = dw_color_depth(); char buf[10]; HPIXMAP text1pm,text2pm; @@ -157,15 +157,15 @@ dw_box_pack_start( notebookbox2, pagebox, 1, 1, TRUE, TRUE, 0); textbox1 = dw_render_new( 100 ); - dw_box_pack_start( pagebox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 4); + dw_box_pack_start( pagebox, textbox1, font_width*width1, font_height*rows, TRUE, TRUE, 4); dw_window_set_font(textbox1, "9.WarpSans"); textbox2 = dw_render_new( 101 ); dw_box_pack_start( pagebox, textbox2, font_width*width2, font_height*rows, TRUE, TRUE, 4); dw_window_set_font(textbox2, "9.WarpSans"); - text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, 32 ); - text2pm = dw_pixmap_new( textbox2, font_width*width2, font_height*rows, 32 ); + text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, depth ); + text2pm = dw_pixmap_new( textbox2, font_width*width2, font_height*rows, depth ); dw_color_foreground_set(DW_CLR_WHITE); dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); @@ -210,14 +210,14 @@ notebookbox1 = dw_box_new( BOXVERT, 5 ); notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE ); dw_notebook_pack( notebook, notebookpage1, notebookbox1 ); - fprintf( stderr, "page1: %d\n", notebookpage1 ); + fprintf( stderr, "page1: %ld\n", notebookpage1 ); dw_notebook_page_set_text( notebook, notebookpage1, "first page"); archive_add(); notebookbox2 = dw_box_new( BOXVERT, 5 ); notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE ); dw_notebook_pack( notebook, notebookpage2, notebookbox2 ); - fprintf( stderr, "page2: %d\n",notebookpage2); + fprintf( stderr, "page2: %ld\n",notebookpage2); dw_notebook_page_set_text( notebook, notebookpage2, "second page"); text_add();
--- a/gtk/dw.c Fri Jan 17 23:28:28 2003 +0000 +++ b/gtk/dw.c Fri Jan 17 23:52:44 2003 +0000 @@ -4595,6 +4595,19 @@ return tmp; } +/* Returns a GdkColor from a DW color */ +GdkColor _internal_color(unsigned long value) +{ + if(DW_RGB_COLOR & value) + { + GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; + return color; + } + else if (value < 16) + return _colors[value]; + return _colors[0]; +} + /* Sets the current foreground drawing color. * Parameters: * red: red value. @@ -4604,7 +4617,7 @@ void dw_color_foreground_set(unsigned long value) { int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); - GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; + GdkColor color = _internal_color(value); DW_MUTEX_LOCK; gdk_color_alloc(_dw_cmap, &color); @@ -4621,7 +4634,7 @@ void dw_color_background_set(unsigned long value) { int _locked_by_me = FALSE, index = _find_thread_index(dw_thread_id()); - GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; + GdkColor color = _internal_color(value); DW_MUTEX_LOCK; gdk_color_alloc(_dw_cmap, &color);