Setup_Video::Setup_Video(): mFullScreenEnabled(config.getValue("screen", false)), mOpenGLEnabled(config.getValue("opengl", false)), mCustomCursorEnabled(config.getValue("customcursor", true)), mNameEnabled(config.getValue("showownname", false)), mPickupChatEnabled(config.getValue("showpickupchat", true)), mPickupParticleEnabled(config.getValue("showpickupparticle", false)), mOpacity(config.getValue("guialpha", 0.8)), mMouseOpacity(config.getValue("mousealpha", 0.7)), mFps((int) config.getValue("fpslimit", 0)), mSpeechMode((int) config.getValue("speech", 3)), mScreenWidth(graphics->getWidth()), mScreenHeight(graphics->getHeight()), mModeListModel(new ModeListModel), mModeList(new ListBox(mModeListModel, "videomode", this)), mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)), mOpenGLCheckBox(new CheckBox(_("OpenGL"), mOpenGLEnabled)), mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)), mNameCheckBox(new CheckBox(_("Show name"), mNameEnabled)), mSpeechSlider(new Slider(0, 3)), mSpeechModeLabel(new Label("")), mAlphaSlider(new Slider(0.2, 1.0)), mMouseAlphaSlider(new Slider(0.2, 1.0)), mFpsCheckBox(new CheckBox(_("FPS Limit:"))), mFpsSlider(new Slider(5, 200)), mFpsField(new TextField), mFontSize((int) config.getValue("fontSize", 11)), mFontSizeSlider(new Slider(8, 14)), mFontSizeLabel(new Label("")), mOverlayDetail((int) config.getValue("OverlayDetail", 2)), mOverlayDetailSlider(new Slider(0, 2)), mOverlayDetailLabel(new Label("")), mParticleDetail(3 - (int) config.getValue("particleEmitterSkip", 1)), mParticleDetailSlider(new Slider(-1, 3)), mParticleDetailLabel(new Label("")), mPickupNotifyLabel(new Label(_("Show pickup notification"))), mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)), mPickupParticleCheckBox(new CheckBox(_("as particle"), mPickupParticleEnabled)) { setName(_("Video")); ScrollArea *scrollArea = new ScrollArea(mModeList); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); scrollArea->setWidth(90); speechLabel = new Label(_("Overhead text")); alphaLabel = new Label(_("Gui opacity")); mouseAlphaLabel = new Label(_("Mouse opacity")); fontSizeLabel = new Label(_("Font size")); overlayDetailLabel = new Label(_("Ambient FX")); particleDetailLabel = new Label(_("Particle detail")); mModeList->setEnabled(true); #ifndef USE_OPENGL mOpenGLCheckBox->setEnabled(false); #endif mAlphaSlider->setValue(mOpacity); mMouseAlphaSlider->setValue(mMouseOpacity); mFpsField->setText(toString(mFps)); mFpsField->setWidth(30); mFpsField->setEnabled(false); mFpsSlider->setValue(mFps); mFpsSlider->setEnabled(mFps > 0); mFpsCheckBox->setSelected(mFps > 0); mCustomCursorCheckBox->setActionEventId("customcursor"); mPickupChatCheckBox->setActionEventId("pickupchat"); mPickupParticleCheckBox->setActionEventId("pickupparticle"); mNameCheckBox->setActionEventId("showownname"); mAlphaSlider->setActionEventId("guialpha"); mMouseAlphaSlider->setActionEventId("mousealpha"); mFpsCheckBox->setActionEventId("fpslimitcheckbox"); mSpeechSlider->setActionEventId("speech"); mFpsSlider->setActionEventId("fpslimitslider"); mFontSizeSlider->setActionEventId("fontsizeslider"); mOverlayDetailSlider->setActionEventId("overlaydetailslider"); mParticleDetailSlider->setActionEventId("particledetailslider"); mCustomCursorCheckBox->addActionListener(this); mPickupChatCheckBox->addActionListener(this); mPickupParticleCheckBox->addActionListener(this); mNameCheckBox->addActionListener(this); mAlphaSlider->addActionListener(this); mMouseAlphaSlider->addActionListener(this); mFpsCheckBox->addActionListener(this); mSpeechSlider->addActionListener(this); mFpsSlider->addActionListener(this); mFontSizeSlider->addActionListener(this); mOverlayDetailSlider->addActionListener(this); mParticleDetailSlider->addActionListener(this); setSpeechModeLabel(mSpeechMode); mSpeechSlider->setValue(mSpeechMode); mFontSize = (int) config.getValue("fontSize", 11); mFontSizeLabel->setCaption(strprintf(_("%d Point"), mFontSize)); mFontSizeSlider->setValue(mFontSize); setOverlayDetailLabel(mOverlayDetail); mOverlayDetailSlider->setValue(mOverlayDetail); setParticleDetailLabel(mParticleDetail); mParticleDetailSlider->setValue(mParticleDetail); mFpsSlider->setStepLength(1.0); mFontSizeSlider->setStepLength(1.0); mSpeechSlider->setStepLength(1.0); mOverlayDetailSlider->setStepLength(1.0); mParticleDetailSlider->setStepLength(1.0); // Do the layout LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); place(0, 0, scrollArea, 1, 6).setPadding(2); place(1, 0, mFsCheckBox, 2); place(3, 0, mOpenGLCheckBox, 1); place(1, 1, mCustomCursorCheckBox, 3); place(1, 2, mNameCheckBox, 3); place(1, 3, mPickupNotifyLabel, 3); place(1, 4, mPickupChatCheckBox, 1); place(2, 4, mPickupParticleCheckBox, 2); place(0, 6, mAlphaSlider); place(0, 7, mMouseAlphaSlider); place(0, 8, mFpsSlider); place(0, 9, mFontSizeSlider); place(0, 10, mSpeechSlider); place(0, 11, mOverlayDetailSlider); place(0, 12, mParticleDetailSlider); place(1, 6, alphaLabel, 3).setPadding(2); place(1, 7, mouseAlphaLabel, 3).setPadding(2); place(1, 8, mFpsCheckBox).setPadding(3); place(1, 9, fontSizeLabel); place(1, 10, speechLabel); place(1, 11, overlayDetailLabel); place(1, 12, particleDetailLabel); place(2, 8, mFpsField).setPadding(1); place(2, 9, mFontSizeLabel, 3).setPadding(2); place(2, 10, mSpeechModeLabel, 3).setPadding(2); place(2, 11, mOverlayDetailLabel, 3).setPadding(2); place(2, 12, mParticleDetailLabel, 3).setPadding(2); setDimension(gcn::Rectangle(0, 0, 325, 280)); }
Setup_Video::Setup_Video(): mFullScreenEnabled(config.getBoolValue("screen")), mOpenGLEnabled(config.getIntValue("opengl")), mCustomCursorEnabled(config.getBoolValue("customcursor")), mFps(config.getIntValue("fpslimit")), mAltFps(config.getIntValue("altfpslimit")), mEnableResize(config.getBoolValue("enableresize")), mNoFrame(config.getBoolValue("noframe")), mModeListModel(new ModeListModel), mModeList(new ListBox(mModeListModel)), mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)), mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)), mEnableResizeCheckBox(new CheckBox(_("Enable resize"), mEnableResize)), mNoFrameCheckBox(new CheckBox(_("No frame"), mNoFrame)), mFpsCheckBox(new CheckBox(_("FPS limit:"))), mFpsSlider(new Slider(2, 160)), mFpsLabel(new Label), mAltFpsSlider(new Slider(2, 160)), mAltFpsLabel(new Label(_("Alt FPS limit: "))), #ifdef WIN32 mDetectButton(new Button(_("Detect best mode"), "detect", this)), #else mDetectButton(nullptr), #endif mDialog(nullptr) { setName(_("Video")); ScrollArea *scrollArea = new ScrollArea(mModeList); scrollArea->setWidth(150); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mOpenGLListModel = new OpenGLListModel; mOpenGLDropDown = new DropDown(mOpenGLListModel), mOpenGLDropDown->setSelected(mOpenGLEnabled); mModeList->setEnabled(true); #ifndef USE_OPENGL mOpenGLDropDown->setSelected(0); #endif mFpsLabel->setCaption(mFps > 0 ? toString(mFps) : _("None")); mFpsLabel->setWidth(60); mAltFpsLabel->setCaption(_("Alt FPS limit: ") + (mAltFps > 0 ? toString(mAltFps) : _("None"))); mAltFpsLabel->setWidth(150); mFpsSlider->setValue(mFps); mFpsSlider->setEnabled(mFps > 0); mAltFpsSlider->setValue(mAltFps); mAltFpsSlider->setEnabled(mAltFps > 0); mFpsCheckBox->setSelected(mFps > 0); // Pre-select the current video mode. std::string videoMode = toString(mainGraphics->mWidth) + "x" + toString(mainGraphics->mHeight); mModeList->setSelected(mModeListModel->getIndexOf(videoMode)); mModeList->setActionEventId("videomode"); mCustomCursorCheckBox->setActionEventId("customcursor"); mFpsCheckBox->setActionEventId("fpslimitcheckbox"); mFpsSlider->setActionEventId("fpslimitslider"); mAltFpsSlider->setActionEventId("altfpslimitslider"); mOpenGLDropDown->setActionEventId("opengl"); mEnableResizeCheckBox->setActionEventId("enableresize"); mNoFrameCheckBox->setActionEventId("noframe"); mModeList->addActionListener(this); mCustomCursorCheckBox->addActionListener(this); mFpsCheckBox->addActionListener(this); mFpsSlider->addActionListener(this); mAltFpsSlider->addActionListener(this); mOpenGLDropDown->addActionListener(this); mEnableResizeCheckBox->addActionListener(this); mNoFrameCheckBox->addActionListener(this); // Do the layout LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); place(0, 0, scrollArea, 1, 5).setPadding(2); place(0, 5, mOpenGLDropDown, 1); place(1, 0, mFsCheckBox, 2); place(1, 1, mCustomCursorCheckBox, 3); place(1, 2, mEnableResizeCheckBox, 2); place(1, 3, mNoFrameCheckBox, 2); place(0, 6, mFpsSlider); place(1, 6, mFpsCheckBox).setPadding(3); place(2, 6, mFpsLabel).setPadding(1); place(0, 7, mAltFpsSlider); place(1, 7, mAltFpsLabel).setPadding(3); #ifdef WIN32 place(0, 8, mDetectButton); #endif int width = 600; if (config.getIntValue("screenwidth") >= 730) width += 100; setDimension(gcn::Rectangle(0, 0, width, 300)); }