AboutDialog::AboutDialog(wxWindow* parent) :
        wxDialog(parent, wxID_ANY, wxT("About")) {
            IO::FileManager fileManager;
            
            wxBitmap icon(fileManager.appendPath(fileManager.resourceDirectory(), "Icon.png"), wxBITMAP_TYPE_PNG);
            
            wxStaticBitmap* appIcon = new wxStaticBitmap(this, wxID_ANY, icon);
            wxStaticLine* appLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
            wxStaticText* appName = new wxStaticText(this, wxID_ANY, wxT("TrenchBroom"));
            appName->SetFont(appName->GetFont().Larger().Larger().Larger().Larger().Bold());
            
            wxStaticText* appClaim = new wxStaticText(this, wxID_ANY, wxT("A Modern Level Editor for Quake"));
            
            wxString versionStr(wxT("Version "));
            versionStr << VERSIONSTR;
            
            wxStaticText* version = new wxStaticText(this, wxID_ANY, versionStr);
            
            wxStaticText* devHeader = new wxStaticText(this, wxID_ANY, wxT("Development"));
            devHeader->SetFont(devHeader->GetFont().Bold());
            wxStaticText* devText = new wxStaticText(this, wxID_ANY, wxT("Kristian Duske"));
            
            wxStaticText* contrHeader = new wxStaticText(this, wxID_ANY, wxT("Contributions"));
            contrHeader->SetFont(contrHeader->GetFont().Bold());
            wxSizer* contrText = CreateTextSizer(wxT("Corey Jones (feedback, testing, documentation)\nAndré König (feedback, testing)\nWouter van Oortmerssen (feedback)\nHannes Kröger (testing)\nMorgan Allen (testing)\nForest Hale (fov code)\nChristian Grawert (Quake.fdg)"));
            
            wxSizer* copyright = CreateTextSizer(wxT("Copyright 2010-2013 Kristian Duske\nQuake is a registered trademark of id Software"));

            wxGridBagSizer* sizer = new wxGridBagSizer();

            int row = 0;
            sizer->Add(0, 10, wxGBPosition(row++, 1));
            sizer->AddGrowableRow(static_cast<size_t>(row - 1));
            sizer->Add(appName, wxGBPosition(row++, 1));
            sizer->Add(appLine, wxGBPosition(row++, 1), wxDefaultSpan, wxEXPAND);
            sizer->Add(appClaim, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(version, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(devHeader, wxGBPosition(row++, 1));
            sizer->Add(devText, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(contrHeader, wxGBPosition(row++, 1));
            sizer->Add(contrText, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(copyright, wxGBPosition(row++, 1));
            sizer->Add(0, 10, wxGBPosition(row++, 1));
            sizer->AddGrowableRow(static_cast<size_t>(row - 1));
            sizer->Add(appIcon, wxGBPosition(0, 0), wxGBSpan(row, 1), wxALIGN_CENTER);
            
            SetSizer(sizer);
            SetSize(650, 420);
            CenterOnParent();
            
            SetBackgroundColour(*wxWHITE);
        }
Beispiel #2
0
void Console::logToFile(const LogMessage& message) {
#if defined __APPLE__
    NSLogWrapper(message.string());
#else
    IO::FileManager fileManager;
    const String logDirectory = fileManager.logDirectory();
    if (logDirectory.empty())
        return;
    if (!fileManager.exists(logDirectory))
        fileManager.makeDirectory(logDirectory);
    const String logFilePath = fileManager.appendPath(logDirectory, "TrenchBroom.log");
    std::fstream logStream(logFilePath.c_str(), std::ios::out | std::ios::app);
    if (logStream.is_open()) {
        wxDateTime now = wxDateTime::Now();
        logStream << wxGetProcessId() << " " << now.FormatISOCombined(' ') << ": " << message.string() << std::endl;
    }
#endif
}
        void MapPropertiesDialog::Create(wxWindow* parent, Model::MapDocument& document) {
            wxDialog::Create(parent, wxID_ANY, wxT("Map Properties"));
            m_document = &document;

            const int width = 330;

            wxStaticBox* modBox = new wxStaticBox(this, wxID_ANY, wxT("Entity Definitions"));
            wxStaticText* defText = new wxStaticText(modBox, wxID_ANY, wxT("Select an entity definition file for this map."));
#if defined __APPLE__
            defText->SetFont(*wxSMALL_FONT);
#endif
            defText->Wrap(width);
            m_defChoice = new wxChoice(modBox, CommandIds::MapPropertiesDialog::DefChoiceId);

            wxStaticText* modText = new wxStaticText(modBox, wxID_ANY, wxT("Select a subdirectory within your Quake directory to search for entity models. ID1 is always searched in addition to the selected subdirectory."));
#if defined __APPLE__
            modText->SetFont(*wxSMALL_FONT);
#endif
            modText->Wrap(width);
            m_modChoice = new wxChoice(modBox, CommandIds::MapPropertiesDialog::ModChoiceId);

            wxSizer* modBoxSizer = new wxBoxSizer(wxVERTICAL);
            modBoxSizer->AddSpacer(LayoutConstants::StaticBoxTopMargin);
            modBoxSizer->Add(defText, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            modBoxSizer->AddSpacer(LayoutConstants::ControlVerticalMargin);
            modBoxSizer->Add(m_defChoice, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            modBoxSizer->AddSpacer(2 * LayoutConstants::ControlVerticalMargin);
            modBoxSizer->Add(modText, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            modBoxSizer->AddSpacer(LayoutConstants::ControlVerticalMargin);
            modBoxSizer->Add(m_modChoice, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            modBoxSizer->AddSpacer(LayoutConstants::StaticBoxBottomMargin);
            modBox->SetSizerAndFit(modBoxSizer);

            IO::FileManager fileManager;
            String resourcePath = fileManager.resourceDirectory();

            wxBitmap add(fileManager.appendPath(resourcePath, "Add.png"), wxBITMAP_TYPE_PNG);
            wxBitmap remove(fileManager.appendPath(resourcePath, "Remove.png"), wxBITMAP_TYPE_PNG);
            wxBitmap up(fileManager.appendPath(resourcePath, "Up.png"), wxBITMAP_TYPE_PNG);
            wxBitmap down(fileManager.appendPath(resourcePath, "Down.png"), wxBITMAP_TYPE_PNG);

            wxStaticBox* wadBox = new wxStaticBox(this, wxID_ANY, wxT("Texture Wads"));
            wxStaticText* wadText = new wxStaticText(wadBox, wxID_ANY, wxT("Manage the wad files for this map. Wad files are searched from bottom to top, so textures in the lower entries override textures in the upper entries if the names of the textures are the same."));
#if defined __APPLE__
            wadText->SetFont(*wxSMALL_FONT);
#endif
            wadText->Wrap(width);

            m_wadList = new WadListBox(wadBox, CommandIds::MapPropertiesDialog::WadListId);
            m_wadList->SetMinSize(wxSize(wxDefaultSize.x, 120));
            m_addWadButton = new wxBitmapButton(wadBox, CommandIds::MapPropertiesDialog::AddWadButtonId, add, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN);
            m_addWadButton->SetMinSize(wxSize(20, 20));
            m_removeWadsButton = new wxBitmapButton(wadBox, CommandIds::MapPropertiesDialog::RemoveWadsButtonId, remove, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN);
            m_removeWadsButton->SetMinSize(wxSize(20, 20));
            m_moveWadUpButton = new wxBitmapButton(wadBox, CommandIds::MapPropertiesDialog::MoveWadUpButtonId, up, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN);
            m_moveWadUpButton->SetMinSize(wxSize(20, 20));
            m_moveWadDownButton = new wxBitmapButton(wadBox, CommandIds::MapPropertiesDialog::MoveWadDownButtonId, down, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN);
            m_moveWadDownButton->SetMinSize(wxSize(20, 20));

            wxSizer* wadButtonsSizer = new wxBoxSizer(wxHORIZONTAL);
            wadButtonsSizer->Add(m_addWadButton);
            wadButtonsSizer->AddSpacer(LayoutConstants::ControlHorizontalMargin);
            wadButtonsSizer->Add(m_removeWadsButton);
            wadButtonsSizer->AddSpacer(LayoutConstants::ControlHorizontalMargin);
            wadButtonsSizer->Add(m_moveWadUpButton);
            wadButtonsSizer->AddSpacer(LayoutConstants::ControlHorizontalMargin);
            wadButtonsSizer->Add(m_moveWadDownButton);

            wxSizer* wadBoxSizer = new wxBoxSizer(wxVERTICAL);
            wadBoxSizer->AddSpacer(LayoutConstants::StaticBoxTopMargin);
            wadBoxSizer->Add(wadText, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            wadBoxSizer->AddSpacer(LayoutConstants::ControlVerticalMargin);
            wadBoxSizer->Add(m_wadList, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            wadBoxSizer->AddSpacer(LayoutConstants::ControlVerticalMargin);
            wadBoxSizer->Add(wadButtonsSizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_LEFT, LayoutConstants::StaticBoxSideMargin);
            wadBoxSizer->AddSpacer(LayoutConstants::StaticBoxBottomMargin);
            wadBox->SetSizerAndFit(wadBoxSizer);

            wxStaticBox* coordBox = new wxStaticBox(this, wxID_ANY, wxT("Plane Point Coordinates"));
            wxStaticText* coordText = new wxStaticText(coordBox, wxID_ANY, wxT("By default, TrenchBroom stores plane point coordinates as floating point values internally and in the map file. Checking this option will force it to use integer coordinates. This improves compatibility with older compilers, but it will lead to less precision when editing vertices."));
#if defined __APPLE__
            coordText->SetFont(*wxSMALL_FONT);
#endif
            coordText->Wrap(width);
            m_intFacePointsCheckBox = new wxCheckBox(coordBox, CommandIds::MapPropertiesDialog::ForceIntCoordsId, wxT("Force integer plane points"));

            wxSizer* coordBoxSizer = new wxBoxSizer(wxVERTICAL);
            coordBoxSizer->AddSpacer(LayoutConstants::StaticBoxTopMargin);
            coordBoxSizer->Add(coordText, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            coordBoxSizer->AddSpacer(LayoutConstants::ControlVerticalMargin);
            coordBoxSizer->Add(m_intFacePointsCheckBox, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::StaticBoxSideMargin);
            coordBoxSizer->AddSpacer(LayoutConstants::StaticBoxBottomMargin);
            coordBox->SetSizerAndFit(coordBoxSizer);

            wxSizer* buttonSizer = CreateButtonSizer(wxCLOSE);
            SetAffirmativeId(wxCLOSE);
            SetEscapeId(wxCLOSE);

            wxSizer* outerSizer = new wxBoxSizer(wxVERTICAL);
            outerSizer->Add(modBox, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, LayoutConstants::DialogOuterMargin);
            outerSizer->AddSpacer(LayoutConstants::ControlVerticalMargin);
            outerSizer->Add(wadBox, 1, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::DialogOuterMargin);
            outerSizer->AddSpacer(LayoutConstants::ControlVerticalMargin);
            outerSizer->Add(coordBox, 0, wxEXPAND | wxLEFT | wxRIGHT, LayoutConstants::DialogOuterMargin);
            outerSizer->Add(buttonSizer, 0, wxEXPAND | wxALL, LayoutConstants::DialogButtonMargin);

            SetSizerAndFit(outerSizer);

#ifdef __APPLE__
            // allow the dialog to be closed using CMD+W
            wxAcceleratorEntry acceleratorEntries[1];
            acceleratorEntries[0].Set(wxACCEL_CMD, static_cast<int>('W'), wxID_CLOSE);
            wxAcceleratorTable accceleratorTable(1, acceleratorEntries);
            SetAcceleratorTable(accceleratorTable);
#endif

            init();

            CommandProcessor::BeginGroup(m_document->GetCommandProcessor(), "Edit map properties");
        }