static bool posix_addlimit(int limit, const char *name, Array &ret) { char hard[80]; snprintf(hard, 80, "hard %s", name); char soft[80]; snprintf(soft, 80, "soft %s", name); struct rlimit rl; int result = getrlimit(limit, &rl); if (result < 0) { return false; } String softStr(soft, CopyString); String hardStr(hard, CopyString); if (rl.rlim_cur == RLIM_INFINITY) { ret.set(softStr, "unlimited"); } else { ret.set(softStr, (int)rl.rlim_cur); } if (rl.rlim_max == RLIM_INFINITY) { ret.set(hardStr, "unlimited"); } else { ret.set(hardStr, (int)rl.rlim_max); } return true; }
void CTTToeView::initializeControls(void) { buttonStyle = new ButtonStyle(); objectsToDelete.push_back(buttonStyle); buttonStyle->finalColor = Clr(215,62,0); buttonStyle->finalColorFrame = Clr(52,48,46); buttonStyle->startColor = Clr(62,56,52); buttonStyle->startColorFrame = Clr(180,180,180); buttonStyle->finalStatus = 16; buttonStyle->highlightStatus = 3; buttonStyle->textColor = Clr(150,150,150); buttonStyle2 = new ButtonStyle(); objectsToDelete.push_back(buttonStyle2); buttonStyle2->finalColor = Clr(215,62,0); buttonStyle2->finalColorFrame = Clr(52,48,46); buttonStyle2->startColor = Clr(62,56,52); buttonStyle2->startColorFrame = Clr(180,180,180); buttonStyle2->finalStatus = 16; buttonStyle2->highlightStatus = 3; buttonStyle2->textColor = Clr(225,82,20); buttonStyle3 = new ButtonStyle(); objectsToDelete.push_back(buttonStyle3); buttonStyle3->finalColor = Clr(215,62,0); buttonStyle3->finalColorFrame = Clr(52,48,46); buttonStyle3->startColor = Clr(42,37,34); buttonStyle3->startColorFrame = Clr(180,180,180); buttonStyle3->finalStatus = 16; buttonStyle3->highlightStatus = 3; buttonStyle3->textColor = Clr(225,82,20); openButtonStyle = new ButtonStyle(); objectsToDelete.push_back(openButtonStyle); openButtonStyle->finalColor = Clr(120,120,120); openButtonStyle->finalColorFrame = Clr(100,100,100); openButtonStyle->startColor = Clr(42,37,34); openButtonStyle->startColorFrame = Clr(40,45,32); openButtonStyle->finalStatus = 50; openButtonStyle->highlightStatus = 22; openButtonStyle->textColor = Clr(215,62,0); string s("Empty"); string l("<"); string r(">"); string easyStr("-"); string hardStr("+"); swingButtonStyle = new SwingButtonStyle(); objectsToDelete.push_back(swingButtonStyle); swingButtonStyle->buttonStyle = buttonStyle; swingButtonStyle->labelBGColor = Clr(62,56,52); swingButtonStyle->labelBGTransparent = false; swingButtonStyle->labelColor = Clr(200,200,200); menuNavButtonStyle = new SwingButtonStyle(); objectsToDelete.push_back(menuNavButtonStyle); menuNavButtonStyle->buttonStyle = buttonStyle3; menuNavButtonStyle->labelBGColor = Clr(62,56,52); menuNavButtonStyle->labelBGTransparent = false; menuNavButtonStyle->labelColor = Clr(200,200,200); menuNavButtonStyle->labelExists = false; //46/16/30 swb_FieldSize = new SwingButton(FSIZE_DECREASE,FSIZE_INCREASE,Point(20,50),60,178,20,"",l,r,swingButtonStyle); objectsToDelete.push_back(swb_FieldSize); swb_SubCellSize = new SwingButton(SUBCELLSIZE_DECREASE,SUBCELLSIZE_INCREASE,Point(20,50),60,178,20,"",l,r,swingButtonStyle); objectsToDelete.push_back(swb_SubCellSize); swb_SubCellNumber = new SwingButton(NUM_OF_SUBCELLS_DECREASE,NUM_OF_SUBCELLS_INCREASE,Point(20,50),60,178,20,"",l,r,swingButtonStyle); objectsToDelete.push_back(swb_SubCellNumber); swb_GameLevel = new SwingButton(DECREASE_GAME_LEVEL,INCREASE_GAME_LEVEL,Point(20,50),60,178,20,"",easyStr,hardStr,swingButtonStyle); objectsToDelete.push_back(swb_GameLevel); swb_CellDistance = new SwingButton(DIST_CELL_DECREASE,DIST_CELL_INCREASE,Point(20,50),60,178,20,"",l,r,swingButtonStyle); objectsToDelete.push_back(swb_CellDistance); swb_RootCellNum = new SwingButton(DECREASE_BASE_SEL_NUM,INCREASE_BASE_SEL_NUM,Point(20,50),60,178,20,"",easyStr,hardStr,swingButtonStyle); objectsToDelete.push_back(swb_RootCellNum); swb_SearchDepth = new SwingButton(DECREASE_DEPTH,INCREASE_DEPTH,Point(20,50),60,178,20,"",easyStr,hardStr,swingButtonStyle); objectsToDelete.push_back(swb_SearchDepth); swb_CellNum = new SwingButton(DECREASE_SEL_NUM,INCREASE_SEL_NUM,Point(20,50),60,178,20,"",easyStr,hardStr,swingButtonStyle); objectsToDelete.push_back(swb_CellNum); bt_Color = new Button(CHANGE_COLOR,Point(0,0),40,178,"Colour",buttonStyle); objectsToDelete.push_back(bt_Color); bt_Growing = new Button(CHANGE_GROWING,Point(0,0),40,178,"",buttonStyle); objectsToDelete.push_back(bt_Growing); bt_StylePreset = new Button(CHANGE_STYLE,Point(0,0),40,178,string("Change Style!"),buttonStyle2); objectsToDelete.push_back(bt_StylePreset); bt_DoubleBuffering = new Button(CHANGE_DOUBLE_BUFFERING,Point(0,0),40,178,string(""),buttonStyle); objectsToDelete.push_back(bt_DoubleBuffering); bt_FieldFrame = new Button(SHOW_HIDE_FIELD_FRAME,Point(0,0),40,178,string(""),buttonStyle); objectsToDelete.push_back(bt_FieldFrame); bt_FieldLines = new Button(SHOW_HIDE_SEP_LINES,Point(0,0),40,178,string(""),buttonStyle); objectsToDelete.push_back(bt_FieldLines); bt_ShowTrack = new Button(SHOW_TRACK,Point(0,0),40,178,string(""),buttonStyle); objectsToDelete.push_back(bt_ShowTrack); menuStyle = new MenuStyle(); objectsToDelete.push_back(menuStyle); menuStyle->bGColor = Clr(62,56,52); menuStyle->labelColor = Clr(210,210,210); menuStyle->labelBGTransparent = false; menuStyle->labelBGColor = Clr(42,37,34); menuStyle->labelHeight = 50; menuStyle->openButtonStyle = openButtonStyle; menuStyle->navigationButtonStyle = menuNavButtonStyle; menuStyle->elementsMarginLeft = 1; menuStyle->elementsMarginTop = 20; menuStyle->panelWidthUnderNavButton = 15; menuStyle->marginBetweenElements = 3; menuStyle->closeA = 10; menuStyle->closeVo = 0; menuStyle->openVo = 6; menuStyle->openA = - 1; menuStyle->maxStickSpeed = 6; menuStyle->reflectionCoef = 0.50; }