Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
mock gui for additional options
Browse files Browse the repository at this point in the history
  • Loading branch information
maoserr committed Aug 31, 2010
1 parent b86fd98 commit 97a8ca4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 41 deletions.
23 changes: 11 additions & 12 deletions src/backends/randr.c
Expand Up @@ -150,6 +150,16 @@ int randr_init(int screen_num, int crtc_num)
/* Save size and gamma ramps of all CRTCs.
Current gamma ramps are saved so we can restore them
at program exit. */
/* Allocate space for saved gamma ramps */
saved_ramps = malloc(state.crtc_count*3*ramp_size
*sizeof(uint16_t));
if ( !saved_ramps ) {
perror("malloc");
LOG(LOGERR,_("Memory allocation error."));
free(gamma_get_reply);
xcb_disconnect(state.conn);
/*@i1@*/return RET_FUN_FAILED;
}
for (i = 0; i < ((int)state.crtc_count); i++) {
/*@i2@*/xcb_randr_crtc_t crtc = state.crtcs[i].crtc;

Expand Down Expand Up @@ -200,16 +210,6 @@ int randr_init(int screen_num, int crtc_num)
gamma_g = xcb_randr_get_crtc_gamma_green(gamma_get_reply);
gamma_b = xcb_randr_get_crtc_gamma_blue(gamma_get_reply);

/* Allocate space for saved gamma ramps */
state.crtcs[i].saved_ramps =
malloc(3*ramp_size*sizeof(uint16_t));
if (state.crtcs[i].saved_ramps == NULL) {
perror("malloc");
free(gamma_get_reply);
xcb_disconnect(state.conn);
/*@i1@*/return RET_FUN_FAILED;
}

/* Copy gamma ramps into CRTC state */
/*@i6@*/memcpy(state.crtcs[i].saved_ramps+0*ramp_size, gamma_r,
ramp_size*sizeof(uint16_t));
Expand Down Expand Up @@ -273,11 +273,10 @@ int randr_free(void){
return RET_FUN_FAILED;

/* Free CRTC state */
for( i=0; i<state.crtc_count; ++i ){
for( i=0; i<(int)state.crtc_count; ++i ){
if( state.crtcs[i].saved_ramps!=NULL ){
LOG(LOGVERBOSE,_("Freeing Randr CRTC %d"),i);
free(state.crtcs[i].saved_ramps);
state.crtcs[i].saved_ramps=NULL;
}
}
free(state.crtcs);
Expand Down
65 changes: 36 additions & 29 deletions src/gui/iupgui_settings.c
Expand Up @@ -314,34 +314,30 @@ static Hcntrl _settings_create_events(void){
return frame_events;
}

// Create weather frame
static Hcntrl _settings_create_weather(void){
Hcntrl frame_weather;
Hcntrl chk_enable;
Hcntrl spn_interval;
Hcntrl label_spn=IupLabel(_("Update interval (minutes)"));
Hcntrl label_txt=IupLabel(_("Weather based on lat/lon."));

chk_enable = IupToggle(_("Enable"),NULL);
spn_interval = IupSetAttributes(IupText(NULL),
"VISIBLE=NO,SPIN=YES,SPINVALUE=60,"
"SPINMIN=10,SPINMAX=180");
frame_weather = IupFrame(
IupSetAttributes(
IupVbox(label_txt,chk_enable,
IupHbox(label_spn,spn_interval,NULL),NULL),
"MARGIN=5")
);
IupSetAttribute(frame_weather,"TITLE",_("Weather"));
return frame_weather;
}

// Create logging frame
static Hcntrl _settings_create_logging(void){

Hcntrl frame_logging;
Hcntrl chk_logging;
Hcntrl edt_logging;
Hcntrl list_loglvl;

list_loglvl = IupSetAtt(NULL,IupList(NULL),"1",
_("Error/Warnings"),"2",_("Info"),"3",
_("Debug"),"VALUE","1",NULL);
chk_logging = IupToggle(_("Log to file"),NULL);
edt_logging = IupSetAtt(NULL,IupText(NULL),"VALUE",
_("./log.txt"),NULL);
frame_logging = IupFrame(
IupSetAttributes(
IupVbox(list_loglvl,chk_logging,edt_logging,NULL),
"MARGIN=5"));
IupSetAttribute(frame_logging,"TITLE",_("Logging"));
return frame_logging;
}

// Create gamma frame
static Hcntrl _settings_create_gamma(void){

}

// Create additional gamma frame

Expand Down Expand Up @@ -416,10 +412,11 @@ static void _settings_create(void){
frame_day,
frame_night,
frame_startup,
frame_icons,
frame_speed,
frame_elev,

frame_events,
frame_logging,
frame_icons,
tabs_all,

button_cancel,
Expand All @@ -431,9 +428,12 @@ static void _settings_create(void){
frame_day = _settings_create_day_temp();
frame_night = _settings_create_night_temp();
frame_startup = _settings_create_startup();
frame_icons = _settings_create_icons();
frame_speed = _settings_create_tran();
frame_elev = _settings_create_elev();
frame_events = _settings_create_events();
frame_logging = _settings_create_logging();
frame_icons = _settings_create_icons();


// Tabs containing settings
tabs_all = IupTabs(
Expand All @@ -448,9 +448,16 @@ static void _settings_create(void){
frame_speed,
frame_elev,
NULL),
IupVbox(
frame_events,
frame_logging,
frame_icons,
NULL),
NULL);
(void)IupSetAttributes(tabs_all,"TABTITLE0=Basic,"
"TABTITLE1=Transition");
(void)IupSetAttributes(tabs_all,
"TABTITLE0=Basic,"
"TABTITLE1=Transition"
"TABTITLE2=Advanced");

// Buttons
button_cancel = IupButton(_("Cancel"),NULL);
Expand Down

0 comments on commit 97a8ca4

Please sign in to comment.