void Border::SetBorder(int size, Color color) { SetBorder(LEFT, size, color); SetBorder(TOP, size, color); SetBorder(RIGHT, size, color); SetBorder(BOTTOM, size, color); }
wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag, double pixel_scale) : wxHtmlContainerCell(parent) { m_PixelScale = pixel_scale; m_ColsInfo = NULL; m_NumCols = m_NumRows = 0; m_CellInfo = NULL; m_ActualCol = m_ActualRow = -1; /* scan params: */ if (tag.GetParamAsColour(wxT("BGCOLOR"), &m_tBkg)) SetBackgroundColour(m_tBkg); m_tValign = tag.GetParam(wxT("VALIGN")); if (!tag.GetParamAsInt(wxT("CELLSPACING"), &m_Spacing)) m_Spacing = 2; if (!tag.GetParamAsInt(wxT("CELLPADDING"), &m_Padding)) m_Padding = 3; m_Spacing = (int)(m_PixelScale * (double)m_Spacing); m_Padding = (int)(m_PixelScale * (double)m_Padding); if(tag.HasParam(wxT("BORDER"))) { if(tag.GetParam("BORDER").IsEmpty()) m_Border = 1; else tag.GetParamAsInt(wxT("BORDER"), &m_Border); } if (m_Border == 1) SetBorder(TABLE_BORDER_CLR_1, TABLE_BORDER_CLR_2, m_Border); // special case see wxHtmlContainerCell::Draw else if (m_Border> 0) SetBorder(TABLE_BORDER_CLR_1, TABLE_BORDER_CLR_2, (int)(m_PixelScale * (double)m_Border)); else m_Border = 0; }
void _BMCMenuBar_::_Init() { SetFlags(Flags() | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE); SetBorder(B_BORDER_CONTENTS); float left, top, right, bottom; GetItemMargins(&left, &top, &right, &bottom); #if 0 // TODO: Better fix would be to make BMenuItem draw text properly // centered font_height fontHeight; GetFontHeight(&fontHeight); top = ceilf((Bounds().Height() - ceilf(fontHeight.ascent) - ceilf(fontHeight.descent)) / 2) + 1; bottom = top - 1; #else // TODO: Fix content location properly. This is just a quick fix to // make the BMenuField label and the super-item of the BMenuBar // align vertically. top++; bottom--; #endif if (be_control_look != NULL) left = right = be_control_look->DefaultLabelSpacing(); SetItemMargins(left, top, right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom); }
CCreateToySourcePanel::CCreateToySourcePanel() : glgui::CMovablePanel("Create Toy Source Tool") { SetBackgroundColor(Color(0, 0, 0, 255)); SetHeaderColor(Color(100, 100, 100, 255)); SetBorder(glgui::CPanel::BT_SOME); m_pToyFileLabel = new glgui::CLabel("Toy File:", "sans-serif", 10); m_pToyFileLabel->SetAlign(glgui::CLabel::TA_TOPLEFT); AddControl(m_pToyFileLabel); m_pToyFileText = new glgui::CTextField(); m_pToyFileText->SetContentsChangedListener(this, ToyChanged); AddControl(m_pToyFileText); m_pSourceFileLabel = new glgui::CLabel("Source File:", "sans-serif", 10); m_pSourceFileLabel->SetAlign(glgui::CLabel::TA_TOPLEFT); AddControl(m_pSourceFileLabel); m_pSourceFileText = new glgui::CTextField(); m_pSourceFileText->SetContentsChangedListener(this, SourceChanged); AddControl(m_pSourceFileText); m_pWarnings = new glgui::CLabel(""); m_pWarnings->SetAlign(glgui::CLabel::TA_TOPLEFT); AddControl(m_pWarnings); m_pCreate = new glgui::CButton("Create"); m_pCreate->SetClickedListener(this, Create); AddControl(m_pCreate); }
void uddPageElement::Initialize() { // nastavení neprůhlednosti (bílé barvy) okrajům m_pMarginLeft->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginTop->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginRight->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginBottom->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginLeft->SetBorder( *wxTRANSPARENT_PEN ); m_pMarginTop->SetBorder( *wxTRANSPARENT_PEN ); m_pMarginRight->SetBorder( *wxTRANSPARENT_PEN ); m_pMarginBottom->SetBorder( *wxTRANSPARENT_PEN ); SetFill( *wxWHITE_BRUSH ); SetBorder( *wxBLACK_PEN ); AddStyle( sfsSHOW_SHADOW ); // přidání stylu stínu RemoveStyle(sfsSIZE_CHANGE); // znemožnění změny velikosti m_pShapeInside->AcceptChild( wxT("uddImageItemElement") ); m_pShapeInside->AcceptChild( wxT("uddTableItemElement") ); m_pShapeInside->SetBorder( *wxLIGHT_GREY_PEN ); m_pageSize = MilimetersToPixels( 210.0, 297.0 ); // nastavení velikosti papíru this->SetMargins( 0, 0, 0, 0 ); // nastavení okrajů (pro inicilizaci velikosti) }
CCFMOTD::CCFMOTD() : CPanel(MENU_SPACE, MENU_SPACE, MENU_WIDTH, MENU_HEIGHT) { Assert(!s_pMOTD); s_pMOTD = this; SetBorder(BT_NONE); m_pHostname = new CLabel(0, 0, GetWidth(), BTN_HEIGHT, ""); m_pHostname->SetText(CRootPanel::GetRoot()->GetHostname()); AddControl(m_pHostname); m_pTextPanel = new CPanel(0, BTN_HEIGHT, GetWidth(), GetHeight()-BTN_HEIGHT*2-BTN_BORDER); AddControl(m_pTextPanel); m_pText = new CLabel(BTN_BORDER, BTN_BORDER, m_pTextPanel->GetWidth()-BTN_BORDER/2, m_pTextPanel->GetHeight()-BTN_BORDER/2, ""); m_pText->SetAlign(CLabel::TA_TOPLEFT); m_pTextPanel->AddControl(m_pText); m_pFinish = new CButton(GetWidth() - BTN_WIDTH, GetHeight() - BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, "#OK"); AddControl(m_pFinish); m_pFinish->SetClickedListener(this, &CCFMOTD::Finish); LoadMOTD(); CRootPanel::GetRoot()->AddControl(this); }
wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag, double pixel_scale) : wxHtmlContainerCell(parent) { m_PixelScale = pixel_scale; m_HasBorders = (tag.HasParam(wxT("BORDER")) && tag.GetParam(wxT("BORDER")) != wxT("0")); m_ColsInfo = NULL; m_NumCols = m_NumRows = 0; m_CellInfo = NULL; m_ActualCol = m_ActualRow = -1; /* scan params: */ if (tag.HasParam(wxT("BGCOLOR"))) { tag.GetParamAsColour(wxT("BGCOLOR"), &m_tBkg); if (m_tBkg.Ok()) SetBackgroundColour(m_tBkg); } if (tag.HasParam(wxT("VALIGN"))) m_tValign = tag.GetParam(wxT("VALIGN")); else m_tValign = wxEmptyString; if (!tag.GetParamAsInt(wxT("CELLSPACING"), &m_Spacing)) m_Spacing = 2; if (!tag.GetParamAsInt(wxT("CELLPADDING"), &m_Padding)) m_Padding = 3; m_Spacing = (int)(m_PixelScale * (double)m_Spacing); m_Padding = (int)(m_PixelScale * (double)m_Padding); if (m_HasBorders) SetBorder(TABLE_BORDER_CLR_1, TABLE_BORDER_CLR_2); }
UI_Textbox* UI_Textbox::SetBorder(uint32 color, uint32 width, bool plastic) { SetBorder(color, width); m_border.plastic = plastic; return this; }
//TODO sensible defaults Log::Log(void) : TextWindow(0, 0, 80, 24, NULL) { conf = Conf::Instance(); /* Xerox */ #define REGISTER_G_LOG_HANDLER(name) \ g_log_set_handler((name), (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \ | G_LOG_FLAG_RECURSION), \ glib_log_handler_, NULL) SetBorder(new Border()); max_lines = conf->GetLogMaxLines(); MoveResize(conf->GetLogDimensions()); /* Register the glib log handlers. */ REGISTER_G_LOG_HANDLER(NULL); REGISTER_G_LOG_HANDLER("GLib"); REGISTER_G_LOG_HANDLER("GModule"); REGISTER_G_LOG_HANDLER("GLib-GObject"); REGISTER_G_LOG_HANDLER("GThread"); /* Redirect the debug messages to stderr */ g_set_print_handler(glib_print_); g_set_printerr_handler(glib_printerr_); /* Set the purple debug callbacks */ purple_debug_set_ui_ops(¢erim_debug_ui_ops); }
void CSmartTooltip::ApplySchemeSettings(IScheme *pScheme) { BaseClass::ApplySchemeSettings( pScheme ); SetBorder( pScheme->GetBorder("ButtonBorder") ); SetBgColor( Color( 150, 170, 220, 160 ) ); }
void CGUIReportBug::ApplySchemeSettings(vgui::IScheme *pScheme) { BaseClass::ApplySchemeSettings( pScheme ); SetFgColor( pScheme->GetColor( "Modfg", GetFgColor() ) ); SetBgColor( Color( 0, 0, 0, 0 ) ); SetBorder( pScheme->GetBorder( "FrameBorder" ) ); }
ProtectedMethod void CGUICommunity::ApplySchemeSettings(vgui::IScheme *pScheme) { BaseClass::ApplySchemeSettings( pScheme ); SetFgColor( pScheme->GetColor("Modfg", GetFgColor()) ); SetBgColor( Color(0, 0, 0, 0) ); SetBorder( pScheme->GetBorder( "FrameBorder" ) ); }
void CHudChatLine::ApplySchemeSettings(vgui::IScheme *pScheme) { BaseClass::ApplySchemeSettings( pScheme ); m_hFont = pScheme->GetFont( "ChatFont" ); SetBorder( NULL ); SetBgColor( Color( 0, 0, 0, 0 ) ); SetFgColor( Color( 0, 0, 0, 0 ) ); SetFont( m_hFont ); }
ProtectedMethod void CWebWindow::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); SetFgColor( pScheme->GetColor("Modfg", GetFgColor()) ); SetBgColor( Color(0, 0, 0, 0) ); SetBorder( pScheme->GetBorder( "FrameBorder" ) ); m_pHTMLMessage = dynamic_cast< vgui::HTML * > ( FindChildByName("HTMLMessage") ); AssertMsg( m_pHTMLMessage, "HTML Widget" ); }
ExtensionsWizard::ExtensionsWizard(wxWindow *parent, const String &title) : WizardBase(parent, title) { m_pageGeneral = new ExtensionsWizardPageGeneral(this); m_pageTemplate = new ExtensionsWizardPageTemplate(this); m_pageFinish = new ExtensionsWizardPageFinish(this); wxWizardPageSimple::Chain(m_pageGeneral, m_pageTemplate); wxWizardPageSimple::Chain(m_pageTemplate, m_pageFinish); SetBorder(0); }
TextBox::TextBox(int boxLength, short width, short height) : InterActiveController(0, 0), textIndex(0), focus(false), enableWrite(false) { boxSize = boxLength; text = vector<char>(boxLength); CONSOLE_CURSOR_INFO newCci = { 100, true }; SetConsoleCursorInfo(handle, &newCci); SetBorder(BorderType::Single); for (int i = 0; i < width; i++) { text[i] = ' '; } }
void ArpBox::MessageReceived(BMessage *message) { status_t err = B_OK; int32 index = 0; BMessage spec; const char* property = 0; int32 what=0; if( message->GetCurrentSpecifier(&index, &spec, &what, &property) == B_OK ) { BPropertyInfo prop_info(properties_box); int32 propi = prop_info.FindMatch(message, index, &spec, what, property); if( propi >= 0 ) { if( properties_box[propi].extra_data == 1 ) { if( message->what == B_SET_PROPERTY ) { const char* str = 0; err = message->FindString("data", &str); if( !err ) { SetLabel(str); InvalidateDimens(); return; } } else if( message->what == B_GET_PROPERTY ) { BMessage ret(B_REPLY); err = ret.AddString("result", Label()); ret.AddInt32("error", err); message->SendReply(&ret); return; } } else if( properties_box[propi].extra_data == 2 ) { if( message->what == B_SET_PROPERTY ) { int32 value = 0; err = message->FindInt32("data", &value); if( !err ) { SetBorder((border_style)value); InvalidateDimens(); return; } } else if( message->what == B_GET_PROPERTY ) { BMessage ret(B_REPLY); err = ret.AddInt32("result", Border()); ret.AddInt32("error", err); message->SendReply(&ret); return; } } } } if( LayoutMessageReceived(message) == B_OK ) return; BBox::MessageReceived(message); }
/** * @brief SetBorderNth * @param img * @param coordsBorder * @param widthBorder * @return */ std::set<int> *SetBorderNth(Image *img, std::set<int> *coordsBorder, int widthBorder) { std::set<int> *ret = new std::set<int>; //Insert initial border ret->insert(coordsBorder->begin(), coordsBorder->end()); for(int i = 0; i < widthBorder; i++) { std::set<int> *tmpBorder = SetBorder(img, ret); ret->insert(tmpBorder->begin(), tmpBorder->end()); } return ret; }
CCFGameInfo::CCFGameInfo() : CPanel(MENU_SPACE, MENU_SPACE, MENU_WIDTH, MENU_HEIGHT) { Assert(!s_pGameInfo); s_pGameInfo = this; SetBorder(BT_NONE); m_pOK = new CButton(GetWidth()/2 + (GetHeight()-BTN_HEIGHT*2-BTN_BORDER)/2 - BTN_WIDTH, GetHeight() - BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, "#OK"); AddControl(m_pOK); m_pOK->SetClickedListener(this, &CCFGameInfo::OK); CRootPanel::GetRoot()->AddControl(this); }
GUIVidget::GUIVidget() { Init(); SetX(0); SetY(0); SetWidth(0); SetHeight(0); SetColor(DEFAULT_CONTROL_COLOR); SetVisible(false); SetDead(false); SetTexture(NULL); SetParent((GUIBaseControl*)NULL); SetBorder(false); SetBorderType(btNone); }
void CBaseHudChatLine::ApplySchemeSettings(vgui::IScheme *pScheme) { BaseClass::ApplySchemeSettings(pScheme); m_hFont = pScheme->GetFont( "Default" ); #ifdef HL1_CLIENT_DLL SetBgColor( Color( 0, 0, 0, 0 ) ); SetFgColor( Color( 0, 0, 0, 0 ) ); SetBorder( NULL ); #else SetBgColor( Color( 0, 0, 0, 100 ) ); #endif m_hFontMarlett = pScheme->GetFont( "Marlett" ); m_clrText = pScheme->GetColor( "FgColor", GetFgColor() ); SetFont( m_hFont ); }
/*********************************************************************** * * Procedure: * HandleExpose - expose event handler * ***********************************************************************/ void HandleExpose() { if (Event.xexpose.count != 0) return; DBUG("HandleExpose","Routine Entered"); if (Tmp_win) { if ((Event.xany.window == Tmp_win->title_w)) { SetTitleBar(Tmp_win,(Scr.Hilite == Tmp_win),False); } else { SetBorder(Tmp_win,(Scr.Hilite == Tmp_win),True,True, Event.xany.window); } } return; }
WebListBox::WebListBox () { miMouseOver = 0; miSelected = 0; mppOption = WEBC_NULL; miNumOptions = 0; mpVScroll = WEBC_NULL; mpHScroll = WEBC_NULL; miSliderWidth = webc_GetDefaultDisplayInt(WEBC_DEFAULT_SLIDER_WIDTH); miTextHeight = miTotalTextHeight = miTotalTextWidth = -1; miLongestOption = 0; mpListener = WEBC_NULL; mStyle = 0; SetFlag(DISPLAY_FLAG_ACCEPTS_FOCUS); SetMargin(LISTBOX_MARGIN); SetPadding(LISTBOX_PADDING); SetBorder(LISTBOX_BORDER); SetSpacing(LISTBOX_SPACING); }
/*********************************************************************** * * Procedure: * HandleLeaveNotify - LeaveNotify event handler * ************************************************************************/ void HandleLeaveNotify() { DBUG("HandleLeaveNotify","Routine Entered"); /* If we leave the root window, then we're really moving * another screen on a multiple screen display, and we * need to de-focus and unhighlight to make sure that we * don't end up with more than one highlighted window at a time */ if(Event.xcrossing.window == Scr.Root) { if(Event.xcrossing.mode == NotifyNormal) { if (Event.xcrossing.detail != NotifyInferior) { if(Scr.Focus != NULL) { SetFocus(Scr.NoFocusWin,NULL,1); } if(Scr.Hilite != NULL) SetBorder(Scr.Hilite,False,True,True,None); } } } }
TeamBox::TeamBox(const std::string& _player_name, const Point2i& _size, uint g) : HBox(_size.y, false, false, false) , ai_level(0) , group(g) { associated_team = NULL; SetMargin(2); SetBorder(transparent_color, 4); Widget::SetBackgroundColor(transparent_color); Profile *res = GetResourceManager().LoadXMLProfile("graphism.xml", false); player_local[0] = LOAD_RES_IMAGE("menu/player_local_human"); player_local[1] = LOAD_RES_IMAGE("menu/player_local_ai"); player_local[2] = LOAD_RES_IMAGE("menu/player_local_ai_dumb"); player_local[3] = LOAD_RES_IMAGE("menu/player_local_ai_strong"); player_remote[0] = LOAD_RES_IMAGE("menu/player_remote_human"); player_remote[1] = LOAD_RES_IMAGE("menu/player_remote_ai"); player_remote[2] = LOAD_RES_IMAGE("menu/player_remote_ai_dumb"); player_remote[3] = LOAD_RES_IMAGE("menu/player_remote_ai_strong"); int width = _size.x - (CHAR_COUNT_WIDGET_SIZE+2*margin+2*border_size); Box * tmp_player_box = new VBox(_size.y-2*border_size, false, false, false); tmp_player_box->SetMargin(4); tmp_player_box->SetNoBorder(); AddWidget(tmp_player_box); tmp_player_box->AddWidget(new NullWidget(Point2i(width, 20))); /******** Box for team logo, commander, custom team, ai & group *******/ HBox *hbox = new HBox(W_UNDEF, false, false, false); hbox->SetMargin(0); hbox->SetNoBorder(); tmp_player_box->AddWidget(hbox); /**** AI ****/ player_type = new PictureWidget(Point2i(40, 40)); player_type->SetSurface(player_local[ai_level]); hbox->AddWidget(player_type); /**** Team Logo ****/ team_logo = new PictureWidget(Point2i(40, 40)); hbox->AddWidget(team_logo); /**** Team name/commander ****/ VBox *vbox = new VBox(W_UNDEF, false, false, false); vbox->SetMargin(0); vbox->SetNoBorder(); hbox->AddWidget(vbox); previous_player_name = "team"; team_name = new Label(previous_player_name, width - (40*2 + 60), Font::FONT_MEDIUM, Font::FONT_BOLD); vbox->AddWidget(team_name); /**** Names: "Head commander" + text/custom team ****/ vbox->AddWidget(new Label(_("Head commander"), width - (40*2 + 60), Font::FONT_SMALL, Font::FONT_BOLD)); /**** Group selection box ****/ nullw = new NullWidget(Point2i(60, 40)); nullw->SetBackgroundColor(TeamGroup::Colors[g]); hbox->AddWidget(nullw); custom_team_list = GetCustomTeamsList().GetList(); custom_team_current_id = 0; if (custom_team_list.empty()) { player_name = new TextBox(_player_name, width, Font::FONT_SMALL, Font::FONT_BOLD); tmp_player_box->AddWidget(player_name); next_custom_team = NULL; previous_custom_team = NULL; } else { next_custom_team = new Button(res, "menu/big_plus"); previous_custom_team = new Button(res, "menu/big_minus"); player_name = new TextBox(_player_name, width - 2 * (next_custom_team->GetSizeX() + 2), Font::FONT_SMALL, Font::FONT_BOLD); Box * tmp_name_box = new HBox(player_name->GetSizeY(), false, false, false); tmp_name_box->SetNoBorder(); tmp_name_box->SetMargin(2); tmp_name_box->AddWidget(previous_custom_team); tmp_name_box->AddWidget(player_name); tmp_name_box->AddWidget(next_custom_team); tmp_player_box->AddWidget(tmp_name_box); } /********** Number of characters **********/ nb_characters = new SpinButtonWithPicture(_("Number of characters"), "menu/ico_play", Point2i(CHAR_COUNT_WIDGET_SIZE, 110), 6, 1, 1, 10); AddWidget(nb_characters); Pack(); }
/* Get the player selection character */ #if 0 /* New function at the bottom */ void amii_player_selection() { register struct Window *cwin; register struct IntuiMessage *imsg; register int aredone = 0; register struct Gadget *gd; static int once = 0; long class, code; amii_clear_nhwindow( WIN_BASE ); if (validrole(flags.initrole)) return; else { flags.initrole=randrole(); return; } #if 0 /* Don't query the user ... instead give random character -jhsa */ #if 0 /* OBSOLETE */ if( *pl_character ){ pl_character[ 0 ] = toupper( pl_character[ 0 ] ); if( index( pl_classes, pl_character[ 0 ] ) ) return; } #endif if( !once ){ if( bigscreen ){ Type_NewWindowStructure1.TopEdge = (HackScreen->Height/2) - (Type_NewWindowStructure1.Height/2); } for( gd = Type_NewWindowStructure1.FirstGadget; gd; gd = gd->NextGadget ) { if( gd->GadgetID != 0 ) SetBorder( gd ); } once = 1; } if( WINVERS_AMIV ) { # ifdef INTUI_NEW_LOOK Type_NewWindowStructure1.Extension = wintags; Type_NewWindowStructure1.Flags |= WFLG_NW_EXTENDED; fillhook.h_Entry = (ULONG(*)())LayerFillHook; fillhook.h_Data = (void *)-2; fillhook.h_SubEntry = 0; #endif } Type_NewWindowStructure1.Screen = HackScreen; if( ( cwin = OpenShWindow( (void *)&Type_NewWindowStructure1 ) ) == NULL ) { return; } #if 0 WindowToFront( cwin ); #endif while( !aredone ) { WaitPort( cwin->UserPort ); while( ( imsg = (void *) GetMsg( cwin->UserPort ) ) != NULL ) { class = imsg->Class; code = imsg->Code; gd = (struct Gadget *)imsg->IAddress; ReplyMsg( (struct Message *)imsg ); switch( class ) { case VANILLAKEY: if( index( pl_classes, toupper( code ) ) ) { pl_character[0] = toupper( code ); aredone = 1; } else if( code == ' ' || code == '\n' || code == '\r' ) { flags.initrole = randrole(); #if 0 /* OBSOLETE */ #ifdef TOURIST strcpy( pl_character, roles[ rnd( 11 ) ] ); #else strcpy( pl_character, roles[ rnd( 10 ) ] ); #endif #endif aredone = 1; amii_clear_nhwindow( WIN_BASE ); CloseShWindow( cwin ); RandomWindow( pl_character ); return; } else if( code == 'q' || code == 'Q' ) { CloseShWindow( cwin ); clearlocks(); exit_nhwindows(NULL); terminate(0); } else DisplayBeep( NULL ); break; case GADGETUP: switch( gd->GadgetID ) { case 1: /* Random Character */ flags.initrole = randrole(); #if 0 /* OBSOLETE */ #ifdef TOURIST strcpy( pl_character, roles[ rnd( 11 ) ] ); #else strcpy( pl_character, roles[ rnd( 10 ) ] ); #endif #endif amii_clear_nhwindow( WIN_BASE ); CloseShWindow( cwin ); RandomWindow( pl_character ); return; default: pl_character[0] = gd->GadgetID; break; } aredone = 1; break; case CLOSEWINDOW: CloseShWindow( cwin ); clearlocks(); exit_nhwindows(NULL); terminate(0); break; } } } amii_clear_nhwindow( WIN_BASE ); CloseShWindow( cwin ); #endif /* Do not query user ... -jhsa */ }
bool Toolkit::ParseOptions( const std::string &json_options ) { #ifdef USE_EMSCRIPTEN jsonxx::Object json; // Read JSON options if (!json.parse(json_options)) { LogError( "Can not parse JSON string." ); return false; } if (json.has<jsonxx::String>("inputFormat")) SetFormat( json.get<jsonxx::String>("inputFormat") ); if (json.has<jsonxx::Number>("scale")) SetScale( json.get<jsonxx::Number>("scale") ); if (json.has<jsonxx::Number>("border")) SetBorder( json.get<jsonxx::Number>("border") ); if (json.has<jsonxx::String>("font")) SetFont(json.get<jsonxx::String>("font")); if (json.has<jsonxx::Number>("pageWidth")) SetPageWidth( json.get<jsonxx::Number>("pageWidth") ); if (json.has<jsonxx::Number>("pageHeight")) SetPageHeight( json.get<jsonxx::Number>("pageHeight") ); if (json.has<jsonxx::Number>("spacingStaff")) SetSpacingStaff( json.get<jsonxx::Number>("spacingStaff") ); if (json.has<jsonxx::Number>("spacingSystem")) SetSpacingSystem( json.get<jsonxx::Number>("spacingSystem") ); if (json.has<jsonxx::String>("rdgXPathQuery")) SetRdgXPathQuery( json.get<jsonxx::String>("rdgXPathQuery") ); // Parse the various flags // Note: it seems that there is a bug with jsonxx and emscripten // Boolean value false do not parse properly. We have to use Number instead if (json.has<jsonxx::Number>("noLayout")) SetNoLayout(json.get<jsonxx::Number>("noLayout")); if (json.has<jsonxx::Number>("ignoreLayout")) SetIgnoreLayout(json.get<jsonxx::Number>("ignoreLayout")); if (json.has<jsonxx::Number>("adjustPageHeight")) SetAdjustPageHeight(json.get<jsonxx::Number>("adjustPageHeight")); if (json.has<jsonxx::Number>("noJustification")) SetNoJustification(json.get<jsonxx::Number>("noJustification")); if (json.has<jsonxx::Number>("showBoundingBoxes")) SetShowBoundingBoxes(json.get<jsonxx::Number>("showBoundingBoxes")); return true; #else // The non js version of the app should not use this function. return false; #endif }
void EditColor() { extern const char *configfile; int i, done = 0, okay = 0; long code, qual, class; register struct Gadget *gd, *dgad; register struct Window *nw; register struct IntuiMessage *imsg; register struct PropInfo *pip; register struct Screen *scrn; long aidx; int msx, msy; int curcol = 0, drag = 0; int bxorx, bxory, bxxlen, bxylen; static UWORD colors[AMII_MAXCOLORS]; static UWORD svcolors[AMII_MAXCOLORS]; static int once = 0; scrn = HackScreen; if (!once) { if (WINVERS_AMIV) { Col_NewWindowStructure1.Width += 300; Col_NewWindowStructure1.Height += 20; Col_NewWindowStructure1.LeftEdge -= 150; Col_BluePen.Width += 300; Col_RedPen.Width += 300; Col_GreenPen.Width += 300; Col_Cancel.LeftEdge += 300; Col_Okay.LeftEdge += 150; Col_Cancel.TopEdge += 20; Col_Save.TopEdge += 20; Col_Okay.TopEdge += 20; } SetBorder(&Col_Okay); SetBorder(&Col_Cancel); SetBorder(&Col_Save); once = 1; } bxylen = Col_NewWindowStructure1.Height - (Col_BluePen.TopEdge + Col_BluePen.Height + 6); bxxlen = Col_BluePen.Width; bxorx = Col_BluePen.LeftEdge; bxory = Col_BluePen.TopEdge + Col_BluePen.Height + 2; /* Save the current colors */ for (i = 0; i < amii_numcolors; ++i) svcolors[i] = colors[i] = GetRGB4(scrn->ViewPort.ColorMap, i); Col_NewWindowStructure1.Screen = scrn; #ifdef INTUI_NEW_LOOK if (IntuitionBase->LibNode.lib_Version >= 37) { ((struct PropInfo *) Col_BluePen.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) Col_RedPen.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) Col_GreenPen.SpecialInfo)->Flags |= PROPNEWLOOK; } #endif if (WINVERS_AMIV || WINVERS_AMII) { #ifdef INTUI_NEW_LOOK Col_NewWindowStructure1.Extension = wintags; Col_NewWindowStructure1.Flags |= WFLG_NW_EXTENDED; #ifdef __GNUC__ fillhook.h_Entry = (void *) &LayerFillHook; #else fillhook.h_Entry = (ULONG (*) ()) LayerFillHook; #endif fillhook.h_Data = (void *) -2; fillhook.h_SubEntry = 0; #endif } nw = OpenWindow((void *) &Col_NewWindowStructure1); if (nw == NULL) { DisplayBeep(NULL); return; } PrintIText(nw->RPort, &Col_IntuiTextList1, 0, 0); ClearCol(nw); DrawCol(nw, curcol, colors); while (!done) { WaitPort(nw->UserPort); while (imsg = (struct IntuiMessage *) GetMsg(nw->UserPort)) { gd = (struct Gadget *) imsg->IAddress; code = imsg->Code; class = imsg->Class; qual = imsg->Qualifier; msx = imsg->MouseX; msy = imsg->MouseY; ReplyMsg((struct Message *) imsg); switch (class) { case VANILLAKEY: if (code == 'v' && qual == AMIGALEFT) okay = done = 1; else if (code == 'b' && qual == AMIGALEFT) okay = 0, done = 1; else if (code == 'o' || code == 'O') okay = done = 1; else if (code == 'c' || code == 'C') okay = 0, done = 1; break; case CLOSEWINDOW: done = 1; break; case GADGETUP: drag = 0; if (gd->GadgetID == GADREDPEN || gd->GadgetID == GADBLUEPEN || gd->GadgetID == GADGREENPEN) { pip = (struct PropInfo *) gd->SpecialInfo; aidx = pip->HorizPot / (MAXPOT / 15); if (gd->GadgetID == GADREDPEN) { colors[curcol] = (colors[curcol] & ~0xf00) | (aidx << 8); LoadRGB4(&scrn->ViewPort, colors, amii_numcolors); } else if (gd->GadgetID == GADBLUEPEN) { colors[curcol] = (colors[curcol] & ~0xf) | aidx; LoadRGB4(&scrn->ViewPort, colors, amii_numcolors); } else if (gd->GadgetID == GADGREENPEN) { colors[curcol] = (colors[curcol] & ~0x0f0) | (aidx << 4); LoadRGB4(&scrn->ViewPort, colors, amii_numcolors); } DispCol(nw, curcol, colors); } else if (gd->GadgetID == GADCOLOKAY) { done = 1; okay = 1; } else if (gd->GadgetID == GADCOLSAVE) { FILE *fp, *nfp; char buf[300], nname[300], oname[300]; int once = 0; fp = fopen(configfile, "r"); if (!fp) { pline("can't find NetHack.cnf"); break; } strcpy(oname, dirname((char *) configfile)); if (oname[strlen(oname) - 1] != ':') { sprintf(nname, "%s/New_NetHack.cnf", oname); strcat(oname, "/"); strcat(oname, "Old_NetHack.cnf"); } else { sprintf(nname, "%sNew_NetHack.cnf", oname); strcat(oname, "Old_NetHack.cnf"); } nfp = fopen(nname, "w"); if (!nfp) { pline("can't write to New_NetHack.cnf"); fclose(fp); break; } while (fgets(buf, sizeof(buf), fp)) { if (strncmp(buf, "PENS=", 5) == 0) { once = 1; fputs("PENS=", nfp); for (i = 0; i < amii_numcolors; ++i) { fprintf(nfp, "%03x", colors[i]); if ((i + 1) < amii_numcolors) putc('/', nfp); } putc('\n', nfp); } else { fputs(buf, nfp); } } /* If none in the file yet, now write it */ if (!once) { fputs("PENS=", nfp); for (i = 0; i < amii_numcolors; ++i) { fprintf(nfp, "%03x", colors[i]); if ((i + 1) < amii_numcolors) putc(',', nfp); } putc('\n', nfp); } fclose(fp); fclose(nfp); unlink(oname); if (filecopy((char *) configfile, oname) == 0) if (filecopy(nname, (char *) configfile) == 0) unlink(nname); done = 1; okay = 1; } else if (gd->GadgetID == GADCOLCANCEL) { done = 1; okay = 0; } break; case GADGETDOWN: drag = 1; dgad = gd; break; case MOUSEMOVE: if (!drag) break; pip = (struct PropInfo *) dgad->SpecialInfo; aidx = pip->HorizPot / (MAXPOT / 15); if (dgad->GadgetID == GADREDPEN) { colors[curcol] = (colors[curcol] & ~0xf00) | (aidx << 8); LoadRGB4(&scrn->ViewPort, colors, amii_numcolors); } else if (dgad->GadgetID == GADBLUEPEN) { colors[curcol] = (colors[curcol] & ~0xf) | aidx; LoadRGB4(&scrn->ViewPort, colors, amii_numcolors); } else if (dgad->GadgetID == GADGREENPEN) { colors[curcol] = (colors[curcol] & ~0x0f0) | (aidx << 4); LoadRGB4(&scrn->ViewPort, colors, amii_numcolors); } DispCol(nw, curcol, colors); break; case MOUSEBUTTONS: if (code == SELECTDOWN) { if (msy > bxory && msy < bxory + bxylen - 1 && msx > bxorx && msx < bxorx + bxxlen - 1) { curcol = (msx - bxorx) / (bxxlen / amii_numcolors); if (curcol >= 0 && curcol < amii_numcolors) DrawCol(nw, curcol, colors); } } break; } } } if (okay) { for (i = 0; i < (amii_numcolors); ++i) sysflags.amii_curmap[i] = colors[i]; LoadRGB4(&scrn->ViewPort, sysflags.amii_curmap, amii_numcolors); } else LoadRGB4(&scrn->ViewPort, svcolors, amii_numcolors); CloseWindow(nw); }
void EditClipping(void) { int i; long mflags; static int sizes[] = { 8, 16, 20, 24, 28, 32, 36 }; char buf[40]; int done = 0, okay = 0; long code, qual, class; register struct Gadget *gd, *dgad; register struct Window *nw; register struct IntuiMessage *imsg; register struct PropInfo *pip; register struct Screen *scrn; long aidx; int lmxsize = mxsize, lmysize = mysize; int lxclipbord = xclipbord, lyclipbord = yclipbord; int msx, msy; int drag = 0; static int once = 0; scrn = HackScreen; if (!once) { SetBorder(&ClipOkay); SetBorder(&ClipCancel); once = 1; } ClipNewWindowStructure1.Screen = scrn; #ifdef INTUI_NEW_LOOK if (IntuitionBase->LibNode.lib_Version >= 37) { ((struct PropInfo *) ClipXSIZE.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) ClipYSIZE.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) ClipXCLIP.SpecialInfo)->Flags |= PROPNEWLOOK; ((struct PropInfo *) ClipYCLIP.SpecialInfo)->Flags |= PROPNEWLOOK; } #endif if (WINVERS_AMIV || WINVERS_AMII) { #ifdef INTUI_NEW_LOOK ClipNewWindowStructure1.Extension = wintags; ClipNewWindowStructure1.Flags |= WFLG_NW_EXTENDED; #ifdef __GNUC__ fillhook.h_Entry = (void *) &LayerFillHook; #else fillhook.h_Entry = (ULONG (*) ()) LayerFillHook; #endif fillhook.h_Data = (void *) -2; fillhook.h_SubEntry = 0; #endif } nw = OpenWindow((void *) &ClipNewWindowStructure1); if (nw == NULL) { DisplayBeep(NULL); return; } ShowClipValues(nw); mflags = AUTOKNOB | FREEHORIZ; #ifdef INTUI_NEW_LOOK if (IntuitionBase->LibNode.lib_Version >= 37) { mflags |= PROPNEWLOOK; } #endif for (i = 0; i < 7; ++i) { if (mxsize <= sizes[i]) break; } NewModifyProp(&ClipXSIZE, nw, NULL, mflags, (i * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); for (i = 0; i < 7; ++i) { if (mysize <= sizes[i]) break; } NewModifyProp(&ClipYSIZE, nw, NULL, mflags, (i * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); NewModifyProp(&ClipXCLIP, nw, NULL, mflags, ((xclipbord - 2) * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); NewModifyProp(&ClipYCLIP, nw, NULL, mflags, ((yclipbord - 2) * MAXPOT) / 6, 0, MAXPOT / 6, 0, 1); while (!done) { WaitPort(nw->UserPort); while (imsg = (struct IntuiMessage *) GetMsg(nw->UserPort)) { gd = (struct Gadget *) imsg->IAddress; code = imsg->Code; class = imsg->Class; qual = imsg->Qualifier; msx = imsg->MouseX; msy = imsg->MouseY; ReplyMsg((struct Message *) imsg); switch (class) { case VANILLAKEY: if (code == '\33') okay = 0, done = 1; else if (code == 'v' && qual == AMIGALEFT) okay = done = 1; else if (code == 'b' && qual == AMIGALEFT) okay = 0, done = 1; else if (code == 'o' || code == 'O') okay = done = 1; else if (code == 'c' || code == 'C') okay = 0, done = 1; break; case CLOSEWINDOW: done = 1; break; case GADGETUP: drag = 0; if (gd->GadgetID == XSIZE || gd->GadgetID == YSIZE || gd->GadgetID == XCLIP || gd->GadgetID == YCLIP) { pip = (struct PropInfo *) gd->SpecialInfo; aidx = pip->HorizPot / (MAXPOT / 6); if (gd->GadgetID == XSIZE) { mxsize = sizes[aidx]; } else if (gd->GadgetID == YSIZE) { mysize = sizes[aidx]; } else if (gd->GadgetID == XCLIP) { xclipbord = aidx + 2; } else if (gd->GadgetID == YCLIP) { yclipbord = aidx + 2; } ShowClipValues(nw); #ifdef OPT_DISPMAP dispmap_sanity(); #endif } else if (gd->GadgetID == GADOKAY) { done = 1; okay = 1; } else if (gd->GadgetID == GADCANCEL) { done = 1; okay = 0; } ReportMouse(0, nw); reclip = 2; doredraw(); flush_glyph_buffer(amii_wins[WIN_MAP]->win); reclip = 0; break; case GADGETDOWN: drag = 1; dgad = gd; ReportMouse(1, nw); break; case MOUSEMOVE: if (!drag) break; pip = (struct PropInfo *) dgad->SpecialInfo; aidx = pip->HorizPot / (MAXPOT / 6); Move(nw->RPort, dgad->LeftEdge + (nw->Width + dgad->Width) + 8, dgad->TopEdge + nw->RPort->TxBaseline); if (dgad->GadgetID == XSIZE) { mxsize = sizes[aidx]; sprintf(buf, "%d ", lmxsize); } else if (dgad->GadgetID == YSIZE) { mysize = sizes[aidx]; sprintf(buf, "%d ", mysize); } else if (dgad->GadgetID == XCLIP) { xclipbord = aidx + 2; sprintf(buf, "%d ", xclipbord); } else if (dgad->GadgetID == YCLIP) { yclipbord = aidx + 2; sprintf(buf, "%d ", yclipbord); } SetAPen(nw->RPort, 5); SetBPen(nw->RPort, amii_otherBPen); SetDrMd(nw->RPort, JAM2); Text(nw->RPort, buf, strlen(buf)); #ifdef OPT_DISPMAP dispmap_sanity(); #endif break; } } } CloseWindow(nw); /* Restore oldvalues if cancelled. */ if (!okay) { mxsize = lmxsize; mysize = lmysize; xclipbord = lxclipbord; yclipbord = lyclipbord; } }
CCFMenu::CCFMenu() : CPanel(MENU_SPACE, MENU_SPACE, MENU_WIDTH, MENU_HEIGHT) { Assert(!s_pMenu); m_bShowingScoreboard = false; SetBorder(BT_NONE); m_pFinish = new CButton(GetWidth() - BTN_BORDER*0 - BTN_WIDTH*1, 0, BTN_WIDTH, BTN_HEIGHT, "#Close"); m_pFinish->SetClickedListener(this, &CCFMenu::Finish); AddControl(m_pFinish); m_pConfigs = new CButton(0, 0, BTN_WIDTH, BTN_HEIGHT, "#Save_Config"); AddControl(m_pConfigs); m_pConfigs->SetClickedListener(this, &CCFMenu::SaveConfig); char* aszNames[] = { "#Team", "#Character", "#Weapon", "#Armor", "#Numen", "#Binding" }; CButton *pButton; int i; for (i = 0; i < 6; i++) { pButton = new CButton(BTN_BORDER*i + BTN_WIDTH*i, 0, BTN_WIDTH, BTN_HEIGHT, aszNames[i], true); pButton->SetClickedListener(this, &CCFMenu::Panel, new KeyValues("choosepanel", "panel", i)); pButton->SetUnclickedListener(this, &CCFMenu::Panel, new KeyValues("choosepanel", "panel", i)); m_apTabs.AddToTail(pButton); AddControl(pButton); } // FIXME: Temporarily disable the Binds tab until we figure out what to do with it. m_apTabs[5]->SetVisible(false); // Deallocated in ~CPanel m_pTeamPanel = new CTeamPanel(); m_pCharPanel = new CCharPanel(); m_pWeapPanel = new CWeapPanel(); m_pArmrPanel = new CArmrPanel(); m_pRunePanel = new CRunePanel(); m_pBindPanel = new CBindPanel(); AddControl(m_pTeamPanel); AddControl(m_pCharPanel); AddControl(m_pWeapPanel); AddControl(m_pArmrPanel); AddControl(m_pRunePanel); AddControl(m_pBindPanel); int iCreditsWidth = BTN_BORDER*6 + BTN_WIDTH*6; m_pCredits = new CLabel(iCreditsWidth, 0, GetWidth()-iCreditsWidth, BTN_HEIGHT, "#Credits"); AddControl(m_pCredits); m_pTips = new CLabel(0, 0, BTN_WIDTH, BTN_HEIGHT, "#Respawn_Tip"); AddControl(m_pTips); Layout(); }