From 414d3ea0b845b8ef2601e67e3d5926fc005ed630 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 02:29:57 +0200 Subject: [PATCH 01/10] fixing demo gfxconf.h --- demos/modules/gwin/list/gfxconf.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/demos/modules/gwin/list/gfxconf.h b/demos/modules/gwin/list/gfxconf.h index 505ff2cc..0e6d6d11 100644 --- a/demos/modules/gwin/list/gfxconf.h +++ b/demos/modules/gwin/list/gfxconf.h @@ -45,7 +45,7 @@ #define GWIN_NEED_WIDGET TRUE #define GWIN_NEED_LABEL TRUE #define GWIN_NEED_LIST TRUE - #define GWIN_NEED_LIST_IMAGES TRUE + #define GWIN_NEED_LIST_IMAGES FALSE /////////////////////////////////////////////////////////////////////////// @@ -91,4 +91,3 @@ #define GFX_USE_GMISC FALSE #endif /* _GFXCONF_H */ - From 9f35f0de7c5c3d7027e9ce39ef10436443d0669b Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 02:58:49 +0200 Subject: [PATCH 02/10] whitespaces - widgets demo --- demos/modules/gwin/widgets/main.c | 210 ++++++++++++++++++++---------- 1 file changed, 143 insertions(+), 67 deletions(-) diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 7c06f3bf..e6cef491 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -117,76 +117,119 @@ static void createWidgets(void) { // Create the Tabs wi.g.show = TRUE; wi.customDraw = gwinRadioDraw_Tab; wi.g.width = ScrWidth/7; wi.g.height = TAB_HEIGHT; wi.g.y = 0; - wi.g.x = 0*wi.g.width; wi.text = "Buttons"; ghTabButtons = gwinRadioCreate(0, &wi, GROUP_TABS); - wi.g.x = 1*wi.g.width; wi.text = "Sliders"; ghTabSliders = gwinRadioCreate(0, &wi, GROUP_TABS); - wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; ghTabCheckboxes = gwinRadioCreate(0, &wi, GROUP_TABS); - wi.g.x = 3*wi.g.width; wi.text = "Radios"; ghTabRadios = gwinRadioCreate(0, &wi, GROUP_TABS); - wi.g.x = 4*wi.g.width; wi.text = "Lists"; ghTabLists = gwinRadioCreate(0, &wi, GROUP_TABS); - wi.g.x = 5*wi.g.width; wi.text = "Labels"; ghTabLabels = gwinRadioCreate(0, &wi, GROUP_TABS); - wi.g.x = 6*wi.g.width; wi.text = "Images"; ghTabImages = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.x = 0*wi.g.width; wi.text = "Buttons"; + ghTabButtons = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.x = 1*wi.g.width; wi.text = "Sliders"; + ghTabSliders = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; + ghTabCheckboxes = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.x = 3*wi.g.width; wi.text = "Radios"; + ghTabRadios = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.x = 4*wi.g.width; wi.text = "Lists"; + ghTabLists = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.x = 5*wi.g.width; wi.text = "Labels"; + ghTabLabels = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.x = 6*wi.g.width; wi.text = "Images"; + ghTabImages = gwinRadioCreate(0, &wi, GROUP_TABS); // Buttons wi.g.show = FALSE; wi.customDraw = 0; wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = TAB_HEIGHT+5; - wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinButtonCreate(0, &wi); - wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; ghButton2 = gwinButtonCreate(0, &wi); - wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; ghButton3 = gwinButtonCreate(0, &wi); - wi.g.x = 0+3*(BUTTON_WIDTH+1); wi.text = "B4"; ghButton4 = gwinButtonCreate(0, &wi); + wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; + ghButton1 = gwinButtonCreate(0, &wi); + wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; + ghButton2 = gwinButtonCreate(0, &wi); + wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; + ghButton3 = gwinButtonCreate(0, &wi); + wi.g.x = 0+3*(BUTTON_WIDTH+1); wi.text = "B4"; + ghButton4 = gwinButtonCreate(0, &wi); // Horizontal Sliders wi.g.width = ScrWidth/2-2; wi.g.height = SLIDER_WIDTH; wi.g.x = ScrWidth/2+1; - wi.g.y = ScrHeight/2-2*(SLIDER_WIDTH+1); wi.text = "S1"; ghSlider1 = gwinSliderCreate(0, &wi); - wi.g.y = ScrHeight/2-1*(SLIDER_WIDTH+1); wi.text = "S2"; ghSlider2 = gwinSliderCreate(0, &wi); + wi.g.y = ScrHeight/2-2*(SLIDER_WIDTH+1); wi.text = "S1"; + ghSlider1 = gwinSliderCreate(0, &wi); + wi.g.y = ScrHeight/2-1*(SLIDER_WIDTH+1); wi.text = "S2"; + ghSlider2 = gwinSliderCreate(0, &wi); // Vertical Sliders wi.g.width = SLIDER_WIDTH; wi.g.height = ScrHeight/2-2; wi.g.y = ScrHeight/2+1; - wi.g.x = 0+0*(SLIDER_WIDTH+1); wi.text = "S3"; ghSlider3 = gwinSliderCreate(0, &wi); - wi.g.x = 0+1*(SLIDER_WIDTH+1); wi.text = "S4"; ghSlider4 = gwinSliderCreate(0, &wi); + wi.g.x = 0+0*(SLIDER_WIDTH+1); wi.text = "S3"; + ghSlider3 = gwinSliderCreate(0, &wi); + wi.g.x = 0+1*(SLIDER_WIDTH+1); wi.text = "S4"; + ghSlider4 = gwinSliderCreate(0, &wi); // Checkboxes - for the 2nd checkbox we apply special drawing before making it visible wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0; - wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCheckboxCreate(0, &wi); + wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; + ghCheckbox1 = gwinCheckboxCreate(0, &wi); wi.customDraw = gwinCheckboxDraw_CheckOnRight; - wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCheckboxCreate(0, &wi); + wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; + ghCheckbox2 = gwinCheckboxCreate(0, &wi); wi.customDraw = 0; wi.g.width = DISABLEALL_WIDTH; - wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Disable All"; ghCheckDisableAll = gwinCheckboxCreate(0, &wi); + wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Disable All"; + ghCheckDisableAll = gwinCheckboxCreate(0, &wi); // Labels wi.g.width = 0; wi.g.height = LABEL_HEIGHT; // dynamic width, fixed height - wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Label"; ghLabel1 = gwinLabelCreate(0, &wi); + wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Label"; + ghLabel1 = gwinLabelCreate(0, &wi); // Radio Buttons wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = TAB_HEIGHT+5; - wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinRadioCreate(0, &wi, GROUP_YESNO); - wi.g.x = 1*wi.g.width; wi.text = "No"; ghRadio2 = gwinRadioCreate(0, &wi, GROUP_YESNO); + wi.g.x = 0*wi.g.width; wi.text = "Yes"; + ghRadio1 = gwinRadioCreate(0, &wi, GROUP_YESNO); + wi.g.x = 1*wi.g.width; wi.text = "No"; + ghRadio2 = gwinRadioCreate(0, &wi, GROUP_YESNO); wi.g.width = COLOR_WIDTH; wi.g.y += RADIO_HEIGHT+5; - wi.g.x = 0*wi.g.width; wi.text = "Black"; ghRadioBlack = gwinRadioCreate(0, &wi, GROUP_COLORS); - wi.g.x = 1*wi.g.width; wi.text = "White"; ghRadioWhite = gwinRadioCreate(0, &wi, GROUP_COLORS); - wi.g.x = 2*wi.g.width; wi.text = "Yellow"; ghRadioYellow = gwinRadioCreate(0, &wi, GROUP_COLORS); + wi.g.x = 0*wi.g.width; wi.text = "Black"; + ghRadioBlack = gwinRadioCreate(0, &wi, GROUP_COLORS); + wi.g.x = 1*wi.g.width; wi.text = "White"; + ghRadioWhite = gwinRadioCreate(0, &wi, GROUP_COLORS); + wi.g.x = 2*wi.g.width; wi.text = "Yellow"; + ghRadioYellow = gwinRadioCreate(0, &wi, GROUP_COLORS); gwinRadioPress(ghRadioWhite); // Lists wi.g.show = FALSE; wi.customDraw = 0; wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = TAB_HEIGHT+5; - wi.g.x = 0+0*(LIST_WIDTH+1); wi.text = "L1"; ghList1 = gwinListCreate(0, &wi, FALSE); - gwinListAddItem(ghList1, "Item 0", FALSE); gwinListAddItem(ghList1, "Item 1", FALSE); - gwinListAddItem(ghList1, "Item 2", FALSE); gwinListAddItem(ghList1, "Item 3", FALSE); - gwinListAddItem(ghList1, "Item 4", FALSE); gwinListAddItem(ghList1, "Item 5", FALSE); - gwinListAddItem(ghList1, "Item 6", FALSE); gwinListAddItem(ghList1, "Item 7", FALSE); - gwinListAddItem(ghList1, "Item 8", FALSE); gwinListAddItem(ghList1, "Item 9", FALSE); - gwinListAddItem(ghList1, "Item 10", FALSE); gwinListAddItem(ghList1, "Item 11", FALSE); - gwinListAddItem(ghList1, "Item 12", FALSE); gwinListAddItem(ghList1, "Item 13", FALSE); - wi.g.x = 0+1*(LIST_WIDTH+1); wi.text = "L2"; ghList2 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList2, "Item 0", FALSE); gwinListAddItem(ghList2, "Item 1", FALSE); - gwinListAddItem(ghList2, "Item 2", FALSE); gwinListAddItem(ghList2, "Item 3", FALSE); - gwinListAddItem(ghList2, "Item 4", FALSE); gwinListAddItem(ghList2, "Item 5", FALSE); - gwinListAddItem(ghList2, "Item 6", FALSE); gwinListAddItem(ghList2, "Item 7", FALSE); - gwinListAddItem(ghList2, "Item 8", FALSE); gwinListAddItem(ghList2, "Item 9", FALSE); - gwinListAddItem(ghList2, "Item 10", FALSE); gwinListAddItem(ghList2, "Item 11", FALSE); - gwinListAddItem(ghList2, "Item 12", FALSE); gwinListAddItem(ghList2, "Item 13", FALSE); - wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; ghList3 = gwinListCreate(0, &wi, TRUE); - gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 1", FALSE); - gwinListAddItem(ghList3, "Item 2", FALSE); gwinListAddItem(ghList3, "Item 3", FALSE); + wi.g.x = 0+0*(LIST_WIDTH+1); wi.text = "L1"; + ghList1 = gwinListCreate(0, &wi, FALSE); + gwinListAddItem(ghList1, "Item 0", FALSE); + gwinListAddItem(ghList1, "Item 1", FALSE); + gwinListAddItem(ghList1, "Item 2", FALSE); + gwinListAddItem(ghList1, "Item 3", FALSE); + gwinListAddItem(ghList1, "Item 4", FALSE); + gwinListAddItem(ghList1, "Item 5", FALSE); + gwinListAddItem(ghList1, "Item 6", FALSE); + gwinListAddItem(ghList1, "Item 7", FALSE); + gwinListAddItem(ghList1, "Item 8", FALSE); + gwinListAddItem(ghList1, "Item 9", FALSE); + gwinListAddItem(ghList1, "Item 10", FALSE); + gwinListAddItem(ghList1, "Item 11", FALSE); + gwinListAddItem(ghList1, "Item 12", FALSE); + gwinListAddItem(ghList1, "Item 13", FALSE); + wi.g.x = 0+1*(LIST_WIDTH+1); wi.text = "L2"; + ghList2 = gwinListCreate(0, &wi, TRUE); + gwinListAddItem(ghList2, "Item 0", FALSE); + gwinListAddItem(ghList2, "Item 1", FALSE); + gwinListAddItem(ghList2, "Item 2", FALSE); + gwinListAddItem(ghList2, "Item 3", FALSE); + gwinListAddItem(ghList2, "Item 4", FALSE); + gwinListAddItem(ghList2, "Item 5", FALSE); + gwinListAddItem(ghList2, "Item 6", FALSE); + gwinListAddItem(ghList2, "Item 7", FALSE); + gwinListAddItem(ghList2, "Item 8", FALSE); + gwinListAddItem(ghList2, "Item 9", FALSE); + gwinListAddItem(ghList2, "Item 10", FALSE); + gwinListAddItem(ghList2, "Item 11", FALSE); + gwinListAddItem(ghList2, "Item 12", FALSE); + gwinListAddItem(ghList2, "Item 13", FALSE); + wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; + ghList3 = gwinListCreate(0, &wi, TRUE); + gwinListAddItem(ghList3, "Item 0", FALSE); + gwinListAddItem(ghList3, "Item 1", FALSE); + gwinListAddItem(ghList3, "Item 2", FALSE); + gwinListAddItem(ghList3, "Item 3", FALSE); gdispImageOpenFile(&imgYesNo, "image_yesno.gif"); gwinListItemSetImage(ghList3, 1, &imgYesNo); gwinListItemSetImage(ghList3, 3, &imgYesNo); @@ -210,33 +253,55 @@ static void createWidgets(void) { */ static void setTab(GHandle tab) { /* Make sure everything is invisible first */ - gwinSetVisible(ghButton1, FALSE); gwinSetVisible(ghButton2, FALSE); - gwinSetVisible(ghButton3, FALSE); gwinSetVisible(ghButton4, FALSE); - gwinSetVisible(ghSlider1, FALSE); gwinSetVisible(ghSlider2, FALSE); - gwinSetVisible(ghSlider3, FALSE); gwinSetVisible(ghSlider4, FALSE); - gwinSetVisible(ghCheckbox1, FALSE); gwinSetVisible(ghCheckbox2, FALSE); gwinSetVisible(ghCheckDisableAll, FALSE); + gwinSetVisible(ghButton1, FALSE); + gwinSetVisible(ghButton2, FALSE); + gwinSetVisible(ghButton3, FALSE); + gwinSetVisible(ghButton4, FALSE); + gwinSetVisible(ghSlider1, FALSE); + gwinSetVisible(ghSlider2, FALSE); + gwinSetVisible(ghSlider3, FALSE); + gwinSetVisible(ghSlider4, FALSE); + gwinSetVisible(ghCheckbox1, FALSE); + gwinSetVisible(ghCheckbox2, FALSE); + gwinSetVisible(ghCheckDisableAll, FALSE); gwinSetVisible(ghLabel1, FALSE); - gwinSetVisible(ghRadio1, FALSE); gwinSetVisible(ghRadio2, FALSE); - gwinSetVisible(ghRadioWhite, FALSE);gwinSetVisible(ghRadioBlack, FALSE);gwinSetVisible(ghRadioYellow, FALSE); - gwinSetVisible(ghList1, FALSE); gwinSetVisible(ghList2, FALSE); gwinSetVisible(ghList3, FALSE); + gwinSetVisible(ghRadio1, FALSE); + gwinSetVisible(ghRadio2, FALSE); + gwinSetVisible(ghRadioWhite, FALSE); + gwinSetVisible(ghRadioBlack, FALSE); + gwinSetVisible(ghRadioYellow, FALSE); + gwinSetVisible(ghList1, FALSE); + gwinSetVisible(ghList2, FALSE); + gwinSetVisible(ghList3, FALSE); gwinSetVisible(ghImage1, FALSE); /* Turn on widgets depending on the tab selected */ if (tab == ghTabButtons) { - gwinSetVisible(ghButton1, TRUE); gwinSetVisible(ghButton2, TRUE); - gwinSetVisible(ghButton3, TRUE); gwinSetVisible(ghButton4, TRUE); + gwinSetVisible(ghButton1, TRUE); + gwinSetVisible(ghButton2, TRUE); + gwinSetVisible(ghButton3, TRUE); + gwinSetVisible(ghButton4, TRUE); } else if (tab == ghTabSliders) { - gwinSetVisible(ghSlider1, TRUE); gwinSetVisible(ghSlider2, TRUE); - gwinSetVisible(ghSlider3, TRUE); gwinSetVisible(ghSlider4, TRUE); + gwinSetVisible(ghSlider1, TRUE); + gwinSetVisible(ghSlider2, TRUE); + gwinSetVisible(ghSlider3, TRUE); + gwinSetVisible(ghSlider4, TRUE); } else if (tab == ghTabCheckboxes) { - gwinSetVisible(ghCheckbox1, TRUE); gwinSetVisible(ghCheckbox2, TRUE); gwinSetVisible(ghCheckDisableAll, TRUE); + gwinSetVisible(ghCheckbox1, TRUE); + gwinSetVisible(ghCheckbox2, TRUE); + gwinSetVisible(ghCheckDisableAll, TRUE); } else if (tab == ghTabLabels) { gwinSetVisible(ghLabel1, TRUE); } else if (tab == ghTabRadios) { - gwinSetVisible(ghRadio1, TRUE); gwinSetVisible(ghRadio2, TRUE); - gwinSetVisible(ghRadioWhite, TRUE); gwinSetVisible(ghRadioBlack, TRUE); gwinSetVisible(ghRadioYellow, TRUE); + gwinSetVisible(ghRadio1, TRUE); + gwinSetVisible(ghRadio2, TRUE); + gwinSetVisible(ghRadioWhite, TRUE); + gwinSetVisible(ghRadioBlack, TRUE); + gwinSetVisible(ghRadioYellow, TRUE); } else if (tab == ghTabLists) { - gwinSetVisible(ghList1, TRUE); gwinSetVisible(ghList2, TRUE); gwinSetVisible(ghList3, TRUE); + gwinSetVisible(ghList1, TRUE); + gwinSetVisible(ghList2, TRUE); + gwinSetVisible(ghList3, TRUE); } else if (tab == ghTabImages) { gwinSetVisible(ghImage1, TRUE); } @@ -246,15 +311,26 @@ static void setTab(GHandle tab) { * Set the enabled state of every widget (except the tabs etc) */ static void setEnabled(bool_t ena) { - gwinSetEnabled(ghButton1, ena); gwinSetEnabled(ghButton2, ena); - gwinSetEnabled(ghButton3, ena); gwinSetEnabled(ghButton4, ena); - gwinSetEnabled(ghSlider1, ena); gwinSetEnabled(ghSlider2, ena); - gwinSetEnabled(ghSlider3, ena); gwinSetEnabled(ghSlider4, ena); - gwinSetEnabled(ghCheckbox1, ena); gwinSetEnabled(ghCheckbox2, ena); //gwinSetEnabled(ghCheckDisableAll, TRUE); + gwinSetEnabled(ghButton1, ena); + gwinSetEnabled(ghButton2, ena); + gwinSetEnabled(ghButton3, ena); + gwinSetEnabled(ghButton4, ena); + gwinSetEnabled(ghSlider1, ena); + gwinSetEnabled(ghSlider2, ena); + gwinSetEnabled(ghSlider3, ena); + gwinSetEnabled(ghSlider4, ena); + gwinSetEnabled(ghCheckbox1, ena); + gwinSetEnabled(ghCheckbox2, ena); + //gwinSetEnabled(ghCheckDisableAll, TRUE); gwinSetEnabled(ghLabel1, ena); - gwinSetEnabled(ghRadio1, ena); gwinSetEnabled(ghRadio2, ena); - gwinSetEnabled(ghList1, ena); gwinSetEnabled(ghList2, ena); gwinSetEnabled(ghList3, ena); - gwinSetEnabled(ghRadioWhite, ena); gwinSetEnabled(ghRadioBlack, ena); gwinSetEnabled(ghRadioYellow, ena); + gwinSetEnabled(ghRadio1, ena); + gwinSetEnabled(ghRadio2, ena); + gwinSetEnabled(ghList1, ena); + gwinSetEnabled(ghList2, ena); + gwinSetEnabled(ghList3, ena); + gwinSetEnabled(ghRadioWhite, ena); + gwinSetEnabled(ghRadioBlack, ena); + gwinSetEnabled(ghRadioYellow, ena); gwinSetEnabled(ghImage1, ena); } From 0b08bb40ede378d376ebcc6beac625e1a5e3f09d Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 03:03:36 +0200 Subject: [PATCH 03/10] Added smooth scrolling list to GWIN demo --- demos/modules/gwin/widgets/main.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index e6cef491..662fbc77 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -80,7 +80,7 @@ static GHandle ghCheckbox1, ghCheckbox2, ghCheckDisableAll; static GHandle ghLabel1; static GHandle ghRadio1, ghRadio2; static GHandle ghRadioBlack, ghRadioWhite, ghRadioYellow; -static GHandle ghList1, ghList2, ghList3; +static GHandle ghList1, ghList2, ghList3, ghList4; static GHandle ghImage1; static gdispImage imgYesNo; @@ -192,7 +192,7 @@ static void createWidgets(void) { // Lists wi.g.show = FALSE; wi.customDraw = 0; wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = TAB_HEIGHT+5; - wi.g.x = 0+0*(LIST_WIDTH+1); wi.text = "L1"; + wi.g.x = 0+0*(LIST_WIDTH+5); wi.text = "L1"; ghList1 = gwinListCreate(0, &wi, FALSE); gwinListAddItem(ghList1, "Item 0", FALSE); gwinListAddItem(ghList1, "Item 1", FALSE); @@ -208,7 +208,7 @@ static void createWidgets(void) { gwinListAddItem(ghList1, "Item 11", FALSE); gwinListAddItem(ghList1, "Item 12", FALSE); gwinListAddItem(ghList1, "Item 13", FALSE); - wi.g.x = 0+1*(LIST_WIDTH+1); wi.text = "L2"; + wi.g.x = 0+1*(LIST_WIDTH+5); wi.text = "L2"; ghList2 = gwinListCreate(0, &wi, TRUE); gwinListAddItem(ghList2, "Item 0", FALSE); gwinListAddItem(ghList2, "Item 1", FALSE); @@ -224,7 +224,7 @@ static void createWidgets(void) { gwinListAddItem(ghList2, "Item 11", FALSE); gwinListAddItem(ghList2, "Item 12", FALSE); gwinListAddItem(ghList2, "Item 13", FALSE); - wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; + wi.g.x = 0+2*(LIST_WIDTH+5); wi.text = "L3"; ghList3 = gwinListCreate(0, &wi, TRUE); gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 1", FALSE); @@ -233,6 +233,23 @@ static void createWidgets(void) { gdispImageOpenFile(&imgYesNo, "image_yesno.gif"); gwinListItemSetImage(ghList3, 1, &imgYesNo); gwinListItemSetImage(ghList3, 3, &imgYesNo); + wi.g.x = 0+3*(LIST_WIDTH+5); wi.text = "L2"; + ghList4 = gwinListCreate(0, &wi, TRUE); + gwinListAddItem(ghList4, "Item 0", FALSE); + gwinListAddItem(ghList4, "Item 1", FALSE); + gwinListAddItem(ghList4, "Item 2", FALSE); + gwinListAddItem(ghList4, "Item 3", FALSE); + gwinListAddItem(ghList4, "Item 4", FALSE); + gwinListAddItem(ghList4, "Item 5", FALSE); + gwinListAddItem(ghList4, "Item 6", FALSE); + gwinListAddItem(ghList4, "Item 7", FALSE); + gwinListAddItem(ghList4, "Item 8", FALSE); + gwinListAddItem(ghList4, "Item 9", FALSE); + gwinListAddItem(ghList4, "Item 10", FALSE); + gwinListAddItem(ghList4, "Item 11", FALSE); + gwinListAddItem(ghList4, "Item 12", FALSE); + gwinListAddItem(ghList4, "Item 13", FALSE); + gwinListSetScroll(ghList4, scrollSmooth); // Image wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200; @@ -273,6 +290,7 @@ static void setTab(GHandle tab) { gwinSetVisible(ghList1, FALSE); gwinSetVisible(ghList2, FALSE); gwinSetVisible(ghList3, FALSE); + gwinSetVisible(ghList4, FALSE); gwinSetVisible(ghImage1, FALSE); /* Turn on widgets depending on the tab selected */ @@ -302,6 +320,7 @@ static void setTab(GHandle tab) { gwinSetVisible(ghList1, TRUE); gwinSetVisible(ghList2, TRUE); gwinSetVisible(ghList3, TRUE); + gwinSetVisible(ghList4, TRUE); } else if (tab == ghTabImages) { gwinSetVisible(ghImage1, TRUE); } @@ -328,6 +347,7 @@ static void setEnabled(bool_t ena) { gwinSetEnabled(ghList1, ena); gwinSetEnabled(ghList2, ena); gwinSetEnabled(ghList3, ena); + gwinSetEnabled(ghList4, ena); gwinSetEnabled(ghRadioWhite, ena); gwinSetEnabled(ghRadioBlack, ena); gwinSetEnabled(ghRadioYellow, ena); From d15d3ee19ba331fb96c8de23a2f385711fde9c66 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:06:28 +0200 Subject: [PATCH 04/10] Added progressbar --- demos/modules/gwin/widgets/gfxconf.h | 1 + demos/modules/gwin/widgets/main.c | 47 ++++++++++++++++++---------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 60de8d8b..3d9c7a34 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -78,6 +78,7 @@ #define GWIN_NEED_IMAGE TRUE #define GWIN_NEED_RADIO TRUE #define GWIN_NEED_LIST TRUE +#define GWIN_NEED_PROGRESSBAR TRUE /* Features for the GFILE subsystem. */ #define GFX_USE_GFILE TRUE diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 662fbc77..ae533697 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -73,7 +73,7 @@ static const GWidgetStyle YellowWidgetStyle = { /* The variables we need */ static GListener gl; static GHandle ghConsole; -static GHandle ghTabButtons, ghTabSliders, ghTabCheckboxes, ghTabLabels, ghTabRadios, ghTabLists, ghTabImages; +static GHandle ghTabButtons, ghTabSliders, ghTabCheckboxes, ghTabLabels, ghTabRadios, ghTabLists, ghTabImages, ghTabProgressbar; static GHandle ghButton1, ghButton2, ghButton3, ghButton4; static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4; static GHandle ghCheckbox1, ghCheckbox2, ghCheckDisableAll; @@ -82,6 +82,7 @@ static GHandle ghRadio1, ghRadio2; static GHandle ghRadioBlack, ghRadioWhite, ghRadioYellow; static GHandle ghList1, ghList2, ghList3, ghList4; static GHandle ghImage1; +static GHandle ghProgressbar1; static gdispImage imgYesNo; /* Some useful macros */ @@ -118,23 +119,26 @@ static void createWidgets(void) { wi.g.show = TRUE; wi.customDraw = gwinRadioDraw_Tab; wi.g.width = ScrWidth/7; wi.g.height = TAB_HEIGHT; wi.g.y = 0; wi.g.x = 0*wi.g.width; wi.text = "Buttons"; - ghTabButtons = gwinRadioCreate(0, &wi, GROUP_TABS); + ghTabButtons = gwinRadioCreate(0, &wi, GROUP_TABS); wi.g.x = 1*wi.g.width; wi.text = "Sliders"; - ghTabSliders = gwinRadioCreate(0, &wi, GROUP_TABS); + ghTabSliders = gwinRadioCreate(0, &wi, GROUP_TABS); wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; - ghTabCheckboxes = gwinRadioCreate(0, &wi, GROUP_TABS); + ghTabCheckboxes = gwinRadioCreate(0, &wi, GROUP_TABS); wi.g.x = 3*wi.g.width; wi.text = "Radios"; - ghTabRadios = gwinRadioCreate(0, &wi, GROUP_TABS); + ghTabRadios = gwinRadioCreate(0, &wi, GROUP_TABS); wi.g.x = 4*wi.g.width; wi.text = "Lists"; - ghTabLists = gwinRadioCreate(0, &wi, GROUP_TABS); + ghTabLists = gwinRadioCreate(0, &wi, GROUP_TABS); wi.g.x = 5*wi.g.width; wi.text = "Labels"; - ghTabLabels = gwinRadioCreate(0, &wi, GROUP_TABS); + ghTabLabels = gwinRadioCreate(0, &wi, GROUP_TABS); wi.g.x = 6*wi.g.width; wi.text = "Images"; - ghTabImages = gwinRadioCreate(0, &wi, GROUP_TABS); + ghTabImages = gwinRadioCreate(0, &wi, GROUP_TABS); + wi.g.y = TAB_HEIGHT; + wi.g.x = 0*wi.g.width; wi.text = "Progressbar"; + ghTabProgressbar = gwinRadioCreate(0, &wi, GROUP_TABS); // Buttons wi.g.show = FALSE; wi.customDraw = 0; - wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = TAB_HEIGHT+5; + wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = 2*TAB_HEIGHT+10; wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinButtonCreate(0, &wi); wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; @@ -160,22 +164,22 @@ static void createWidgets(void) { // Checkboxes - for the 2nd checkbox we apply special drawing before making it visible wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0; - wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; + wi.g.y = 2*TAB_HEIGHT+10+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCheckboxCreate(0, &wi); wi.customDraw = gwinCheckboxDraw_CheckOnRight; - wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; + wi.g.y = 2*TAB_HEIGHT+10+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCheckboxCreate(0, &wi); wi.customDraw = 0; wi.g.width = DISABLEALL_WIDTH; - wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Disable All"; + wi.g.y = 2*TAB_HEIGHT+10+2*(CHECKBOX_HEIGHT+1); wi.text = "Disable All"; ghCheckDisableAll = gwinCheckboxCreate(0, &wi); // Labels wi.g.width = 0; wi.g.height = LABEL_HEIGHT; // dynamic width, fixed height - wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Label"; + wi.g.y = 2*TAB_HEIGHT+10+2*(CHECKBOX_HEIGHT+1); wi.text = "Label"; ghLabel1 = gwinLabelCreate(0, &wi); // Radio Buttons - wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = TAB_HEIGHT+5; + wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = 2*TAB_HEIGHT+10; wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinRadioCreate(0, &wi, GROUP_YESNO); wi.g.x = 1*wi.g.width; wi.text = "No"; @@ -191,7 +195,7 @@ static void createWidgets(void) { // Lists wi.g.show = FALSE; wi.customDraw = 0; - wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = TAB_HEIGHT+5; + wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = 2*TAB_HEIGHT+10; wi.g.x = 0+0*(LIST_WIDTH+5); wi.text = "L1"; ghList1 = gwinListCreate(0, &wi, FALSE); gwinListAddItem(ghList1, "Item 0", FALSE); @@ -252,11 +256,19 @@ static void createWidgets(void) { gwinListSetScroll(ghList4, scrollSmooth); // Image - wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200; + wi.g.x = ScrWidth-210; wi.g.y = 2*TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200; ghImage1 = gwinImageCreate(0, &wi.g); gwinImageOpenFile(ghImage1, "chibios.bmp"); gwinImageCache(ghImage1); + // Progressbar + wi.g.show = FALSE; wi.customDraw = 0; + wi.g.width = 200; wi.g.height = 20; wi.g.y = 2*TAB_HEIGHT+10; + wi.g.x = 20; wi.text = "Progressbar 1"; + ghProgressbar1 = gwinProgressbarCreate(0, &wi); + gwinProgressbarSetResolution(ghProgressbar1, 10); + gwinProgressbarStart(ghProgressbar1, 500); + // Console - we apply some special colors before making it visible wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1; @@ -292,6 +304,7 @@ static void setTab(GHandle tab) { gwinSetVisible(ghList3, FALSE); gwinSetVisible(ghList4, FALSE); gwinSetVisible(ghImage1, FALSE); + gwinSetVisible(ghProgressbar1, FALSE); /* Turn on widgets depending on the tab selected */ if (tab == ghTabButtons) { @@ -323,6 +336,8 @@ static void setTab(GHandle tab) { gwinSetVisible(ghList4, TRUE); } else if (tab == ghTabImages) { gwinSetVisible(ghImage1, TRUE); + } else if (tab == ghTabProgressbar) { + gwinSetVisible(ghProgressbar1, TRUE); } } From 8169a0453b77364a0ef804f43762cc5675f450bf Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:29:50 +0200 Subject: [PATCH 05/10] Added gwinProgressbarStop() --- releases.txt | 1 + src/gwin/progressbar.c | 11 +++++++++++ src/gwin/progressbar.h | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/releases.txt b/releases.txt index 3f438b12..9d2aa386 100644 --- a/releases.txt +++ b/releases.txt @@ -21,6 +21,7 @@ DEPRECTATE: Old image opening functions deprecated. FEATURE: Restructure and simplify the include path for GFX FEATURE: Added LGDP4532 driver by user shilow FEATURE: Support for ChibiOS/RT 3.x +FEATURE: Added gwinProgressbarStop() *** changes after 1.9 *** diff --git a/src/gwin/progressbar.c b/src/gwin/progressbar.c index 37bad3c8..671c0971 100644 --- a/src/gwin/progressbar.c +++ b/src/gwin/progressbar.c @@ -200,6 +200,17 @@ void gwinProgressbarStart(GHandle gh, delaytime_t delay) { #undef gsw } +void gwinProgressbarStop(GHandle gh) { + #define gsw ((GProgressbarObject *)gh) + + if (gh->vmt != (gwinVMT *)&progressbarVMT) + return; + + gtimerStop(&(gsw->gt)); + + #undef gsw +} + /*---------------------------------------------------------- * Custom Draw Routines *----------------------------------------------------------*/ diff --git a/src/gwin/progressbar.h b/src/gwin/progressbar.h index de10783f..1b7e4424 100644 --- a/src/gwin/progressbar.h +++ b/src/gwin/progressbar.h @@ -155,6 +155,15 @@ void gwinProgressbarDecrement(GHandle gh); */ void gwinProgressbarStart(GHandle gh, delaytime_t delay); +/** + * @brief Stop the timer which is started by @p gwinProgressbarStart() + * + * @param[in] gh The window handle (must be a progressbar window) + * + * @api + */ +void gwinProgressbarStop(GHandle gh); + /** * @brief Some custom progressbar drawing routines * @details These function may be passed to @p gwinSetCustomDraw() to get different progressbar drawing styles From 5c3779cf79616539840baae000797a731ed43127 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:39:12 +0200 Subject: [PATCH 06/10] Added gwinProgressbarReset() --- releases.txt | 2 +- src/gwin/progressbar.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/releases.txt b/releases.txt index 9d2aa386..d13d8bc4 100644 --- a/releases.txt +++ b/releases.txt @@ -21,7 +21,7 @@ DEPRECTATE: Old image opening functions deprecated. FEATURE: Restructure and simplify the include path for GFX FEATURE: Added LGDP4532 driver by user shilow FEATURE: Support for ChibiOS/RT 3.x -FEATURE: Added gwinProgressbarStop() +FEATURE: Added gwinProgressbarStop() and gwinProgressbarReset() *** changes after 1.9 *** diff --git a/src/gwin/progressbar.h b/src/gwin/progressbar.h index 1b7e4424..fcf76b12 100644 --- a/src/gwin/progressbar.h +++ b/src/gwin/progressbar.h @@ -138,6 +138,15 @@ void gwinProgressbarDecrement(GHandle gh); */ #define gwinProgressbarGetPosition(gh) (((GProgressbarObject *)(gh))->pos) + /** + * @brief Reset the progressbar to the minimum position + * + * @param[in] gh The window handle (must be a progressbar window) + * + * @api + */ +#define gwinProgressbarReset(gh) gwinProgressbarSetPosition(gh, ((GProgressbarObject *)(gh))->min) + /** * @brief Automatically increments the progress bar * From 1fc155b6b09b19a8b62f50456cce5fc73e87dafa Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:41:50 +0200 Subject: [PATCH 07/10] Fixed progressbar in widgets demo --- demos/modules/gwin/widgets/gfxconf.h | 300 ++++++++++++++++++++------- demos/modules/gwin/widgets/main.c | 8 +- 2 files changed, 230 insertions(+), 78 deletions(-) diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 3d9c7a34..ecabc27d 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -1,95 +1,241 @@ -/* - * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu - * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket +/** + * This file has a different license to the rest of the uGFX system. + * You can copy, modify and distribute this file as you see fit. + * You do not need to publish your source modifications to this file. + * The only thing you are not permitted to do is to relicense it + * under a different license. + */ + +/** + * Copy this file into your project directory and rename it as gfxconf.h + * Edit your copy to turn on the uGFX features you want to use. + * The values below are the defaults. You should delete anything + * you are leaving as default. * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Please use spaces instead of tabs in this file. */ #ifndef _GFXCONF_H #define _GFXCONF_H /* The operating system to use. One of these must be defined - preferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE -//#define GFX_USE_OS_WIN32 FALSE -//#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_CHIBIOS TRUE +//#define GFX_USE_OS_WIN32 TRUE +//#define GFX_USE_OS_LINUX TRUE +//#define GFX_USE_OS_OSX TRUE -/* GFX sub-systems to turn on */ -#define GFX_USE_GDISP TRUE -#define GFX_USE_GWIN TRUE -#define GFX_USE_GINPUT TRUE -#define GFX_USE_GEVENT TRUE -#define GFX_USE_GTIMER TRUE -/* Features for the GDISP sub-system. */ -#define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_CIRCLE TRUE -#define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_IMAGE TRUE -#define GDISP_NEED_CONVEX_POLYGON TRUE -#define GDISP_NEED_CONTROL TRUE -#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE +/////////////////////////////////////////////////////////////////////////// +// GDISP // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GDISP TRUE -/* The following are optional depending on your hardware */ -//#define GDISP_NEED_SCROLL TRUE -//#define GWIN_CONSOLE_USE_HISTORY TRUE -//#define GWIN_CONSOLE_HISTORY_AVERAGING TRUE -//#define GWIN_CONSOLE_HISTORY_ATCREATE TRUE +#define GDISP_NEED_AUTOFLUSH FALSE +#define GDISP_NEED_TIMERFLUSH FALSE +#define GDISP_NEED_VALIDATION TRUE +#define GDISP_NEED_CLIP TRUE +#define GDISP_NEED_CIRCLE TRUE +#define GDISP_NEED_ELLIPSE FALSE +#define GDISP_NEED_ARC FALSE +#define GDISP_NEED_CONVEX_POLYGON TRUE +#define GDISP_NEED_SCROLL FALSE +#define GDISP_NEED_PIXELREAD FALSE +#define GDISP_NEED_CONTROL TRUE +#define GDISP_NEED_QUERY FALSE +#define GDISP_NEED_MULTITHREAD FALSE +#define GDISP_NEED_STREAMING FALSE +#define GDISP_NEED_TEXT TRUE + #define GDISP_NEED_ANTIALIAS TRUE + #define GDISP_NEED_UTF8 TRUE + #define GDISP_NEED_TEXT_KERNING TRUE + #define GDISP_INCLUDE_FONT_UI1 FALSE + #define GDISP_INCLUDE_FONT_UI2 TRUE + #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE + #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE + #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE + #define GDISP_INCLUDE_FONT_FIXED_5X8 FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE + #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE + #define GDISP_INCLUDE_USER_FONTS FALSE -/* GDISP fonts to include */ -#define GDISP_INCLUDE_FONT_UI2 TRUE +#define GDISP_NEED_IMAGE TRUE + #define GDISP_NEED_IMAGE_NATIVE FALSE + #define GDISP_NEED_IMAGE_GIF TRUE + #define GDISP_NEED_IMAGE_BMP TRUE + #define GDISP_NEED_IMAGE_BMP_1 FALSE + #define GDISP_NEED_IMAGE_BMP_4 FALSE + #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE + #define GDISP_NEED_IMAGE_BMP_8 FALSE + #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE + #define GDISP_NEED_IMAGE_BMP_16 FALSE + #define GDISP_NEED_IMAGE_BMP_24 FALSE + #define GDISP_NEED_IMAGE_BMP_32 FALSE + #define GDISP_NEED_IMAGE_JPG FALSE + #define GDISP_NEED_IMAGE_PNG FALSE + #define GDISP_NEED_IMAGE_ACCOUNTING FALSE -/* GDISP image decoders */ -#define GDISP_NEED_IMAGE_GIF TRUE -#define GDISP_NEED_IMAGE_BMP TRUE +#define GDISP_NEED_STARTUP_LOGO FALSE -/* Features for the GWIN subsystem. */ -#define GWIN_NEED_WINDOWMANAGER TRUE -#define GWIN_NEED_CONSOLE TRUE -#define GWIN_NEED_GRAPH TRUE -#define GWIN_NEED_WIDGET TRUE -#define GWIN_NEED_LABEL TRUE -#define GWIN_NEED_BUTTON TRUE -#define GWIN_NEED_SLIDER TRUE -#define GWIN_NEED_CHECKBOX TRUE -#define GWIN_NEED_IMAGE TRUE -#define GWIN_NEED_RADIO TRUE -#define GWIN_NEED_LIST TRUE -#define GWIN_NEED_PROGRESSBAR TRUE +#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE +#define GDISP_LINEBUF_SIZE 128 -/* Features for the GFILE subsystem. */ -#define GFX_USE_GFILE TRUE -#define GFILE_NEED_ROMFS TRUE -//#define GFILE_NEED_NATIVEFS TRUE +#define GDISP_TOTAL_DISPLAYS 1 + #if GDISP_TOTAL_DISPLAYS > 1 + #define GDISP_HARDWARE_STREAM_WRITE FALSE + #define GDISP_HARDWARE_STREAM_READ FALSE + #define GDISP_HARDWARE_STREAM_POS FALSE + #define GDISP_HARDWARE_DRAWPIXEL FALSE + #define GDISP_HARDWARE_CLEARS FALSE + #define GDISP_HARDWARE_FILLS FALSE + #define GDISP_HARDWARE_BITFILLS FALSE + #define GDISP_HARDWARE_SCROLL FALSE + #define GDISP_HARDWARE_PIXELREAD FALSE + #define GDISP_HARDWARE_CONTROL FALSE + #define GDISP_HARDWARE_QUERY FALSE + #define GDISP_HARDWARE_CLIP FALSE + #endif -/* Features for the GINPUT subsystem. */ -#define GINPUT_NEED_MOUSE TRUE +#define GDISP_TOTAL_CONTROLLERS 1 + #if GDISP_TOTAL_CONTROLLERS > 1 + #define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32 + #define GDISP_CONTROLLER_DISPLAYS 1, 1 + #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 + #endif + +#define GDISP_USE_GFXNET FALSE + #define GDISP_GFXNET_PORT 13001 + #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE + #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE + #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE + + +/////////////////////////////////////////////////////////////////////////// +// GWIN // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GWIN TRUE + +#define GWIN_NEED_WINDOWMANAGER TRUE + +#define GWIN_NEED_CONSOLE TRUE + #define GWIN_CONSOLE_USE_HISTORY FALSE + #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE + #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE + #define GWIN_CONSOLE_ESCSEQ FALSE + #define GWIN_CONSOLE_USE_BASESTREAM FALSE + #define GWIN_CONSOLE_USE_FLOAT FALSE +#define GWIN_NEED_GRAPH TRUE + +#define GWIN_NEED_WIDGET TRUE + #define GWIN_NEED_LABEL TRUE + #define GWIN_NEED_BUTTON TRUE + #define GWIN_BUTTON_LAZY_RELEASE FALSE + #define GWIN_NEED_SLIDER TRUE + #define GWIN_NEED_CHECKBOX TRUE + #define GWIN_NEED_IMAGE TRUE + #define GWIN_NEED_IMAGE_ANIMATION TRUE + #define GWIN_NEED_RADIO TRUE + #define GWIN_NEED_LIST TRUE + #define GWIN_NEED_LIST_IMAGES TRUE + #define GWIN_NEED_PROGRESSBAR TRUE + + +/////////////////////////////////////////////////////////////////////////// +// GEVENT // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GEVENT TRUE + +#define GEVENT_ASSERT_NO_RESOURCE FALSE +#define GEVENT_MAXIMUM_SIZE 32 +#define GEVENT_MAX_SOURCE_LISTENERS 32 + + +/////////////////////////////////////////////////////////////////////////// +// GTIMER // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GTIMER TRUE + +#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY +#define GTIMER_THREAD_WORKAREA_SIZE 2048 + + +/////////////////////////////////////////////////////////////////////////// +// GQUEUE // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GQUEUE TRUE + +#define GQUEUE_NEED_ASYNC TRUE +#define GQUEUE_NEED_GSYNC FALSE +#define GQUEUE_NEED_FSYNC FALSE +#define GQUEUE_NEED_BUFFERS FALSE + +/////////////////////////////////////////////////////////////////////////// +// GINPUT // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GINPUT TRUE + +#define GINPUT_NEED_MOUSE TRUE +#define GINPUT_NEED_KEYBOARD FALSE +#define GINPUT_NEED_TOGGLE FALSE +#define GINPUT_NEED_DIAL FALSE + + +/////////////////////////////////////////////////////////////////////////// +// GFILE // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GFILE TRUE + +#define GFILE_NEED_PRINTG FALSE +#define GFILE_NEED_SCANG FALSE +#define GFILE_NEED_STRINGS FALSE +#define GFILE_NEED_STDIO FALSE + #define GFILE_ALLOW_FLOATS FALSE + #define GFILE_ALLOW_DEVICESPECIFIC FALSE + #define GFILE_MAX_GFILES 3 + +#define GFILE_NEED_MEMFS FALSE +#define GFILE_NEED_ROMFS TRUE +#define GFILE_NEED_RAMFS FALSE +#define GFILE_NEED_FATFS FALSE +#define GFILE_NEED_NATIVEFS FALSE +#define GFILE_NEED_CHBIOSFS FALSE + + +/////////////////////////////////////////////////////////////////////////// +// GADC // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GADC FALSE + +#define GADC_MAX_LOWSPEED_DEVICES 4 + + +/////////////////////////////////////////////////////////////////////////// +// GAUDIO // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GAUDIO FALSE + #define GAUDIO_NEED_PLAY FALSE + #define GAUDIO_NEED_RECORD FALSE + + +/////////////////////////////////////////////////////////////////////////// +// GMISC // +/////////////////////////////////////////////////////////////////////////// +#define GFX_USE_GMISC FALSE + +#define GMISC_NEED_ARRAYOPS FALSE +#define GMISC_NEED_FASTTRIG FALSE +#define GMISC_NEED_FIXEDTRIG FALSE +#define GMISC_NEED_INVSQRT FALSE + #define GMISC_INVSQRT_MIXED_ENDIAN FALSE + #define GMISC_INVSQRT_REAL_SLOW FALSE -/* Optional parameters for various subsystems */ -#define GWIN_NEED_LIST_IMAGES TRUE #endif /* _GFXCONF_H */ - diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index ae533697..a9840174 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -267,7 +267,6 @@ static void createWidgets(void) { wi.g.x = 20; wi.text = "Progressbar 1"; ghProgressbar1 = gwinProgressbarCreate(0, &wi); gwinProgressbarSetResolution(ghProgressbar1, 10); - gwinProgressbarStart(ghProgressbar1, 500); // Console - we apply some special colors before making it visible wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; @@ -306,6 +305,10 @@ static void setTab(GHandle tab) { gwinSetVisible(ghImage1, FALSE); gwinSetVisible(ghProgressbar1, FALSE); + // Stop the progress bar + gwinProgressbarStop(ghProgressbar1); + gwinProgressbarReset(ghProgressbar1); + /* Turn on widgets depending on the tab selected */ if (tab == ghTabButtons) { gwinSetVisible(ghButton1, TRUE); @@ -338,6 +341,9 @@ static void setTab(GHandle tab) { gwinSetVisible(ghImage1, TRUE); } else if (tab == ghTabProgressbar) { gwinSetVisible(ghProgressbar1, TRUE); + + // Start the progress bar + gwinProgressbarStart(ghProgressbar1, 500); } } From adff1a0c030027c4eaac3dbe9a411dd33576058f Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:43:54 +0200 Subject: [PATCH 08/10] Updated progressbar demo --- demos/modules/gwin/progressbar/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/demos/modules/gwin/progressbar/main.c b/demos/modules/gwin/progressbar/main.c index 6217f4c1..28ae2c2e 100644 --- a/demos/modules/gwin/progressbar/main.c +++ b/demos/modules/gwin/progressbar/main.c @@ -26,6 +26,9 @@ int main(void) { gwinProgressbarSetResolution(ghProgressbar, 10); gwinProgressbarStart(ghProgressbar, 500); + gfxSleepMilliseconds(3000); + gwinProgressbarReset(ghProgressbar); + //gwinProgressbarSetPosition(ghProgressbar, 42); //gwinProgressbarIncrement(ghProgressbar); //gwinProgressbarDecrement(ghProgressbar); From c3b17604ee456a725328f924a8a3ec339629eb7b Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:55:35 +0200 Subject: [PATCH 09/10] Fixing gwin progressbar destroying process --- src/gwin/progressbar.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gwin/progressbar.c b/src/gwin/progressbar.c index 671c0971..a7acc0ed 100644 --- a/src/gwin/progressbar.c +++ b/src/gwin/progressbar.c @@ -29,12 +29,21 @@ static void ResetDisplayPos(GProgressbarObject *gsw) { gsw->dpos = ((gsw->w.g.width-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min); } +// We have to deinitialize the timer which auto updates the progressbar if any +static void _destroy(GHandle gh) { + #if GFX_USE_GTIMER + gtimerDeinit( &((GProgressbarObject *)gh)->gt ); + #endif + + _gwidgetDestroy(gh); +} + // The progressbar VMT table static const gwidgetVMT progressbarVMT = { { "Progressbar", // The classname sizeof(GProgressbarObject), // The object size - _gwidgetDestroy, // The destroy routine + _destroy, // The destroy routine _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, From a34c0ded1873121431eed41210b7f44c8271ac0a Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:56:22 +0200 Subject: [PATCH 10/10] Updating progressbar demo --- demos/modules/gwin/progressbar/main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/demos/modules/gwin/progressbar/main.c b/demos/modules/gwin/progressbar/main.c index 28ae2c2e..960a3293 100644 --- a/demos/modules/gwin/progressbar/main.c +++ b/demos/modules/gwin/progressbar/main.c @@ -23,15 +23,20 @@ int main(void) { _createWidget(); +#if 1 gwinProgressbarSetResolution(ghProgressbar, 10); gwinProgressbarStart(ghProgressbar, 500); gfxSleepMilliseconds(3000); gwinProgressbarReset(ghProgressbar); - //gwinProgressbarSetPosition(ghProgressbar, 42); - //gwinProgressbarIncrement(ghProgressbar); - //gwinProgressbarDecrement(ghProgressbar); + gfxSleepMilliseconds(3000); + gwinDestroy(ghProgressbar); +#else + gwinProgressbarSetPosition(ghProgressbar, 42); + gwinProgressbarIncrement(ghProgressbar); + gwinProgressbarDecrement(ghProgressbar); +#endif while (1) { gfxSleepMilliseconds(500);