Ejemplo n.º 1
0
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
    : Tab(_tabSupervisor, parent), modified(false)
{
    MainWindow = new QMainWindow;
    MainWindow->setObjectName("MainWindow");

    createMenus();

    createCentralFrame();

    createDeckDock();
    createCardInfoDock();
    createFiltersDock();

    restartLayout();

    this->installEventFilter(this);    

    retranslateUi();
    connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
    refreshShortcuts();

    QTimer::singleShot(0, this, SLOT(checkFirstRunDetected()));
    QTimer::singleShot(0, this, SLOT(loadLayout()));
}
Ejemplo n.º 2
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    // this changes the background color of the widget.
    //ui->tabWidget->setStyleSheet(QString::fromUtf8("background-color: rgb(170, 170, 170);"));
    // initial values for input fields
    ui->doubleSpinBox_SheetWidth->setRange(0,100);
    ui->doubleSpinBox_SheetLength->setRange(0,150);
    ui->doubleSpinBox_SheetWidth->setValue(60);
    ui->doubleSpinBox_SheetLength->setValue(120);
    ui->doubleSpinBox_Clamp->setValue(3);
    ui->doubleSpinBox_Kerf->setValue(.250);
    ui->doubleSpinBox_Web->setValue(.750);
    ui->label_InfoScreen->setText("Turrets");
    ui->label_InfoScreen->setStyleSheet("QLabel {color:#ccc;}");
    // make labels mouse selectable
    ui->label_TotalParts->setTextInteractionFlags(Qt::TextSelectableByMouse);
    ui->label_Yields->setTextInteractionFlags(Qt::TextSelectableByMouse);
    ui->label_Message->setTextInteractionFlags(Qt::TextSelectableByMouse);
    ui->label_Message->setStyleSheet("QLabel {color:#aaa}");

    ui->pushButton_Clone->setStyleSheet("color:#666");

    ui->label_Yields->setStyleSheet("QLabel {color:#000;  font-size:22px; font-weight:none;}");
    ui->label_TotalParts->setStyleSheet("QLabel {color:#333;  font-size:22px; font-weight:none;}");

    //disable buttons at starting
    ui->pushButton_Reset->setDisabled(true);
    ui->pushButton_copyYields->setDisabled(true);
    //painting sheet
    ui->graphicsView_Sheet->setStyleSheet("background-color:#777");

    disableOptions();

    //this will assign a shortcut to the calculate button
    //shortcut for the return key
    QShortcut *returnShortcut = new QShortcut(QKeySequence("Return"), ui->groupBox);
    QObject::connect(returnShortcut, SIGNAL(activated()), ui->pushButton_Calculate, SLOT(click()));
    //shortcut for the enter key
    QShortcut *enterShortcut = new QShortcut(QKeySequence("Enter"), ui->groupBox);
    QObject::connect(enterShortcut, SIGNAL(activated()), ui->pushButton_Calculate, SLOT(click()));

    // statusbar label
    statusLabel = new QLabel(this);
    statusLabel->setText("   Status");
    ui->statusBar->addWidget(statusLabel);
    ui->statusBar->setStyleSheet("color:#333");

    //FINDER
    //make sufix read only
    ui->lineEdit_Sufix->setReadOnly(true);
    ui->graphicsView_Drawing->setStyleSheet("background-color:#FFD700");
    ui->graphicsView_Pdf->setStyleSheet("background-color:#FFD700");
    ui->graphicsView_Dxf->setStyleSheet("background-color:#FFD700");

    // load last saved settings
    loadLayout();
    loadColor();

  }// MainWindow
Ejemplo n.º 3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    entry_dialog(this),
    last_entry_request(""),
    layout_file_name("")
{
    ui->setupUi(this);
    showMaximized();

    config = Configuration::getInstance();

    // Set up default ratios of main sections
    ui->MainSplitter->setStretchFactor(0, 1);
    ui->MainSplitter->setStretchFactor(1, 2);
    ui->MainSplitter->setStretchFactor(2, 1);

    controller = DataModelController::getInstance();
    controller->registerObserver(this);

    qRegisterMetaType<std::string>();
    QObject::connect(this, SIGNAL(newDatumSignal(const DatumInfo*)), this,
                     SLOT(newDatumSlot(const DatumInfo*)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(removeEntitySignal(std::string)), this,
                     SLOT(removeEntitySlot(std::string)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(invalidateAllSignal()), this,
                     SLOT(entitiesInvalidSlot()), Qt::QueuedConnection);
    QObject::connect(&entry_dialog, SIGNAL(confirmedEdit(QString)), this,
                     SLOT(handleDialogEntry(QString)), Qt::QueuedConnection);

    ui->actionOpen_XML->setShortcut                 (Qt::CTRL + Qt::Key_O);
    ui->actionSave_Layout->setShortcut              (Qt::CTRL + Qt::Key_S);
    ui->actionSave_Layout_As->setShortcut           (Qt::CTRL + Qt::Key_A);
    ui->actionLoad_Layout->setShortcut              (Qt::CTRL + Qt::Key_L);
    ui->actionExit->setShortcut                     (Qt::CTRL + Qt::Key_Q);
    ui->actionChangeBroadcastIP->setShortcut        (Qt::CTRL + Qt::Key_I);
    ui->actionChangeBroadcastPort->setShortcut      (Qt::CTRL + Qt::Key_P);
    ui->actionRecord_current_data->setShortcut      (Qt::CTRL + Qt::Key_R);
    ui->actionPlayback_a_recording->setShortcut     (Qt::CTRL + Qt::Key_B);
    ui->actionFast_playback_a_recording->setShortcut(Qt::CTRL + Qt::Key_F);
    ui->actionListen_to_live_traffic->setShortcut   (Qt::CTRL + Qt::Key_E);

    user_msg_count = 0;
    hideUserMessage();

    // Load layout if saved in configuration file
    layout_file_name = QString(config->
            getValue(CONFIG::LAYOUT_FILE_NAME).c_str());
    if(layout_file_name != "")
        loadLayout(layout_file_name);
}
Ejemplo n.º 4
0
KMahjongg::KMahjongg(QWidget * parent)
    : KXmlGuiWindow(parent)
    , m_gameState(GameState::Gameplay)
    , m_gameView(nullptr)
    , m_gameData(nullptr)
    , m_boardLayout(new KMahjonggLayout())
{
    //Use up to 3MB for global application pixmap cache
    QPixmapCache::setCacheLimit(3 * 1024);

    // minimum area required to display the field
    setMinimumSize(320, 320);

    // init board widget
    m_gameScene = new GameScene();

    loadLayout();

    // init game data
    m_gameData = new GameData(m_boardLayout->board());

    // init view and add to window
    m_gameView = new GameView(m_gameScene, m_gameData, this);
    setCentralWidget(m_gameView);

    m_boardEditor = new Editor();
    m_boardEditor->setModal(false);

    setupStatusBar();
    setupKAction();

    m_gameTimer = new KGameClock(this);

    connect(m_gameTimer, &KGameClock::timeChanged, this, &KMahjongg::displayTime);
    connect(m_gameView, &GameView::statusTextChanged, this, &KMahjongg::showStatusText);
    connect(m_gameView, &GameView::itemNumberChanged, this, &KMahjongg::showItemNumber);
    connect(m_gameView, &GameView::gameOver, this, &KMahjongg::gameOver);
    connect(m_gameView, &GameView::demoOrMoveListAnimationOver, this, &KMahjongg::demoOrMoveListAnimationOver);
    connect(m_gameView, &GameView::noMovesAvailable, this, &KMahjongg::noMovesAvailable);
    connect(m_gameScene, &GameScene::rotateCW, m_gameView, &GameView::angleSwitchCW);
    connect(m_gameScene, &GameScene::rotateCCW, m_gameView, &GameView::angleSwitchCCW);

    m_bLastRandomSetting = Prefs::randomLayout();

    loadSettings();

    m_boardEditor->setTilesetFromSettings();

    startNewGame();
}
Ejemplo n.º 5
0
void FormPerson::refreshLayout(QString tableName)
{
    emptyQDataWidgetMapper(tableName);

    /*
    if (tableName.compare("emails"))
         emptyLayout(this->ui->verticalLayout_emailAddresses);
    else if (tableName.compare("phones"))
         emptyLayout(this->ui->verticalLayout_phoneNumbers);*/

    emptyLayout(this->getVerticalLayout(tableName));

    loadLayout(tableName);
}
Ejemplo n.º 6
0
void MainWindow::setupMenuBar()
{
    QMenu *menu = menuBar()->addMenu(tr("&File"));

    QAction *action = menu->addAction(tr("Save layout..."));
    connect(action, SIGNAL(triggered()), this, SLOT(saveLayout()));

    action = menu->addAction(tr("Load layout..."));
    connect(action, SIGNAL(triggered()), this, SLOT(loadLayout()));

    action = menu->addAction(tr("Switch layout direction"));
    connect(action, SIGNAL(triggered()), this, SLOT(switchLayoutDirection()));

    menu->addSeparator();

    menu->addAction(tr("&Quit"), this, SLOT(close()));

    mainWindowMenu = menuBar()->addMenu(tr("Main window"));

    action = mainWindowMenu->addAction(tr("Animated docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & AnimatedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Allow nested docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & AllowNestedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Allow tabbed docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & AllowTabbedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Force tabbed docks"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & ForceTabbedDocks);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    action = mainWindowMenu->addAction(tr("Vertical tabs"));
    action->setCheckable(true);
    action->setChecked(dockOptions() & VerticalTabs);
    connect(action, SIGNAL(toggled(bool)), this, SLOT(setDockOptions()));

    QMenu *toolBarMenu = menuBar()->addMenu(tr("Tool bars"));
    for (int i = 0; i < toolBars.count(); ++i)
        toolBarMenu->addMenu(toolBars.at(i)->menu);

    dockWidgetMenu = menuBar()->addMenu(tr("&Dock Widgets"));
}
Ejemplo n.º 7
0
void Window::remapWindow()
{
  if (m_isAutoRemap) {
    m_isAutoRemap = false;
    this->setVisible(true);
  }

  setBounds(Rect(Point(getBounds().x, getBounds().y),
                 getPreferredSize()));

  // load layout
  loadLayout();

  invalidate();
}
Ejemplo n.º 8
0
void KMahjongg::loadSettings()
{
    // Set the blink-matching-tiles option.
    m_gameView->setMatch(Prefs::showMatchingTiles());

    // Load the tileset.
    if (!m_gameView->setTilesetPath(Prefs::tileSet())) {
        qCDebug(KMAHJONGG_LOG) << "An error occurred when loading the tileset " << Prefs::tileSet() << " KMahjongg will continue with the default tileset.";
    }

    // Load the background
    if (!m_gameView->setBackgroundPath(Prefs::background())) {
        qCDebug(KMAHJONGG_LOG) << "An error occurred when loading the background " << Prefs::background() << " KMahjongg will continue with the default background.";
    }

    // Maybe load a new layout and start a new game if the layout or random mode has changed.
    if (m_boardLayout->path() != Prefs::layout() || m_bLastRandomSetting != Prefs::randomLayout()) {
        // The boardlayout path will likely not be the same as the preference setting if
        // random layouts are set. If they are and were last time we don't want to load
        // a new layout or start a new game when the user may have just changed the
        // tileset, background or other settings.
        // Also, if no saved layout setting, avoid endless recursion via startNewGame.
        if ((!m_bLastRandomSetting || !Prefs::randomLayout()) && !Prefs::layout().isEmpty()) {
            // The user has changed the layout, or the random setting.

            // If random layouts are set a new layout will be loaded when we call
            // startNewGame, so no need to do so here.
            if (!Prefs::randomLayout()) {
                loadLayout();

                delete m_gameData;
                m_gameData = new GameData(m_boardLayout->board());
                m_gameView->setGameData(m_gameData);
            }

            // Track the last random setting.
            m_bLastRandomSetting = Prefs::randomLayout();

            startNewGame();
        }
    }

    saveSettings();
}
Ejemplo n.º 9
0
void newGame()
{
  static int configured = 0;

  if(!configured)
  {
    centre_dialog(dlg);
    configured = 1;
  }

  if(current_view != left_view)
    update();

  if(popup_dialog(dlg, -1) != CANCEL)
    switch(BOARD_SELECTED)
    {
    case 0:  shuffle(); break;
    case 1:  loadLayoutFromFile(); break;
    default: loadLayout(BOARD_SELECTED - 2);
    }
}
Ejemplo n.º 10
0
/* MainWindow::setupLayout
 * Sets up the wxWidgets window layout
 *******************************************************************/
void MainWindow::setupLayout() {
	// Create the wxAUI manager & related things
	m_mgr = new wxAuiManager(this);
	wxAuiPaneInfo p_inf;

	// Set icon
	string icon_filename = appPath("slade.ico", DIR_TEMP);
	theArchiveManager->programResourceArchive()->getEntry("slade.ico")->exportFile(icon_filename);
	SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
	wxRemoveFile(icon_filename);


	// -- Editor Area --
	notebook_tabs = new wxAuiNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE|wxNO_BORDER|wxAUI_NB_WINDOWLIST_BUTTON|wxNB_FLAT);
	notebook_tabs->SetArtProvider(new clAuiTabArt());

	// Setup panel info & add panel
	p_inf.CenterPane();
	p_inf.Name("editor_area");
	p_inf.PaneBorder(false);
	m_mgr->AddPane(notebook_tabs, p_inf);

	// Create Start Page (temporary)
	html_startpage = new wxHtmlWindow(notebook_tabs, -1, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER, "startpage");
	html_startpage->SetName("startpage");
	if (show_start_page) {
		notebook_tabs->AddPage(html_startpage,"Start Page");
		notebook_tabs->SetPageBitmap(0, getIcon("i_logo"));
		createStartPage();
	}
	else
		html_startpage->Show(false);


	// -- Console Panel --
	ConsolePanel *panel_console = new ConsolePanel(this, -1);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Float();
	p_inf.FloatingSize(600, 400);
	p_inf.FloatingPosition(100, 100);
	p_inf.MinSize(-1, 192);
	p_inf.Show(false);
	p_inf.Caption("Console");
	p_inf.Name("console");
	m_mgr->AddPane(panel_console, p_inf);


	// -- Archive Manager Panel --
	panel_archivemanager = new ArchiveManagerPanel(this, notebook_tabs);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Left();
	p_inf.BestSize(192, 480);
	p_inf.Caption("Archive Manager");
	p_inf.Name("archive_manager");
	p_inf.Show(true);
	p_inf.Dock();
	m_mgr->AddPane(panel_archivemanager, p_inf);


	// -- Undo History Panel --
	panel_undo_history = new UndoManagerHistoryPanel(this, NULL);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Right();
	p_inf.BestSize(128, 480);
	p_inf.Caption("Undo History");
	p_inf.Name("undo_history");
	p_inf.Show(false);
	p_inf.Dock();
	m_mgr->AddPane(panel_undo_history, p_inf);


	// -- Menu bar --
	wxMenuBar *menu = new wxMenuBar();

	// File menu
	wxMenu* fileNewMenu = new wxMenu("");
	theApp->getAction("aman_newwad")->addToMenu(fileNewMenu, "&Wad Archive");
	theApp->getAction("aman_newzip")->addToMenu(fileNewMenu, "&Zip Archive");
	wxMenu* fileMenu = new wxMenu("");
	fileMenu->AppendSubMenu(fileNewMenu, "&New", "Create a new Archive");
	theApp->getAction("aman_open")->addToMenu(fileMenu);
	fileMenu->AppendSeparator();
	theApp->getAction("aman_save")->addToMenu(fileMenu);
	theApp->getAction("aman_saveas")->addToMenu(fileMenu);
	theApp->getAction("aman_saveall")->addToMenu(fileMenu);
	fileMenu->AppendSubMenu(panel_archivemanager->getRecentMenu(), "&Recent Files");
	fileMenu->AppendSeparator();
	theApp->getAction("aman_close")->addToMenu(fileMenu);
	theApp->getAction("aman_closeall")->addToMenu(fileMenu);
	fileMenu->AppendSeparator();
	theApp->getAction("main_exit")->addToMenu(fileMenu);
	menu->Append(fileMenu, "&File");

	// Edit menu
	wxMenu* editorMenu = new wxMenu("");
	theApp->getAction("main_undo")->addToMenu(editorMenu);
	theApp->getAction("main_redo")->addToMenu(editorMenu);
	editorMenu->AppendSeparator();
	theApp->getAction("main_setbra")->addToMenu(editorMenu);
	theApp->getAction("main_preferences")->addToMenu(editorMenu);
	menu->Append(editorMenu, "E&dit");

	// View menu
	wxMenu* viewMenu = new wxMenu("");
	theApp->getAction("main_showam")->addToMenu(viewMenu);
	theApp->getAction("main_showconsole")->addToMenu(viewMenu);
	theApp->getAction("main_showundohistory")->addToMenu(viewMenu);
	menu->Append(viewMenu, "&View");

	// Help menu
	wxMenu* helpMenu = new wxMenu("");
	theApp->getAction("main_onlinedocs")->addToMenu(helpMenu);
	theApp->getAction("main_about")->addToMenu(helpMenu);
	menu->Append(helpMenu, "&Help");

	// Set the menu
	SetMenuBar(menu);



	// -- Toolbars --
	toolbar = new SToolBar(this);

	// Create File toolbar
	SToolBarGroup* tbg_file = new SToolBarGroup(toolbar, "_File");
	tbg_file->addActionButton("aman_newwad");
	tbg_file->addActionButton("aman_newzip");
	tbg_file->addActionButton("aman_open");
	tbg_file->addActionButton("aman_save");
	tbg_file->addActionButton("aman_saveas");
	tbg_file->addActionButton("aman_saveall");
	tbg_file->addActionButton("aman_close");
	tbg_file->addActionButton("aman_closeall");
	toolbar->addGroup(tbg_file);

	// Create Archive toolbar
	SToolBarGroup* tbg_archive = new SToolBarGroup(toolbar, "_Archive");
	tbg_archive->addActionButton("arch_newentry");
	tbg_archive->addActionButton("arch_newdir");
	tbg_archive->addActionButton("arch_importfiles");
	tbg_archive->addActionButton("arch_texeditor");
	tbg_archive->addActionButton("arch_mapeditor");
	toolbar->addGroup(tbg_archive);

	// Create Entry toolbar
	SToolBarGroup* tbg_entry = new SToolBarGroup(toolbar, "_Entry");
	tbg_entry->addActionButton("arch_entry_rename");
	tbg_entry->addActionButton("arch_entry_delete");
	tbg_entry->addActionButton("arch_entry_import");
	tbg_entry->addActionButton("arch_entry_export");
	tbg_entry->addActionButton("arch_entry_moveup");
	tbg_entry->addActionButton("arch_entry_movedown");
	toolbar->addGroup(tbg_entry);

	// Create Base Resource Archive toolbar
	SToolBarGroup* tbg_bra = new SToolBarGroup(toolbar, "_Base Resource", true);
	BaseResourceChooser* brc = new BaseResourceChooser(tbg_bra);
	tbg_bra->addCustomControl(brc);
	tbg_bra->addActionButton("main_setbra", "t_settings");
	toolbar->addGroup(tbg_bra);

	// Create Palette Chooser toolbar
	SToolBarGroup* tbg_palette = new SToolBarGroup(toolbar, "_Palette", true);
	palette_chooser = new PaletteChooser(tbg_palette, -1);
	palette_chooser->selectPalette(global_palette);
	tbg_palette->addCustomControl(palette_chooser);
	toolbar->addGroup(tbg_palette);

	// Archive and Entry toolbars are initially disabled
	toolbar->enableGroup("_archive", false);
	toolbar->enableGroup("_entry", false);

	// Add toolbar
	m_mgr->AddPane(toolbar, wxAuiPaneInfo().Top().CaptionVisible(false).MinSize(-1, 30).Resizable(false).PaneBorder(false).Name("toolbar"));


	// -- Status Bar --
	CreateStatusBar(3);


	// Load previously saved perspective string
	loadLayout();

	// Finalize
	m_mgr->Update();
	Layout();

	// Bind events
	html_startpage->Bind(wxEVT_COMMAND_HTML_LINK_CLICKED, &MainWindow::onHTMLLinkClicked, this);
	Bind(wxEVT_SIZE, &MainWindow::onSize, this);
	Bind(wxEVT_CLOSE_WINDOW, &MainWindow::onClose, this);
	Bind(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, &MainWindow::onTabChanged, this);
	Bind(wxEVT_MOVE, &MainWindow::onMove, this);
	Bind(wxEVT_STOOLBAR_LAYOUT_UPDATED, &MainWindow::onToolBarLayoutChanged, this, toolbar->GetId());
}
Ejemplo n.º 11
0
void Layout::updateWithSettings() {
  // Check if user has changed layout
  if(fin.fileName() != gSettings->getLayoutPath()) {
    loadLayout(gSettings->getLayoutPath());
  }
}
Ejemplo n.º 12
0
Layout::Layout() {
  gSettings = new Settings();
  loadLayout(gSettings->getLayoutPath());
}
Ejemplo n.º 13
0
/* MainWindow::setupLayout
 * Sets up the wxWidgets window layout
 *******************************************************************/
void MainWindow::setupLayout()
{
	// Create the wxAUI manager & related things
	m_mgr = new wxAuiManager(this);
	m_mgr->SetArtProvider(new SAuiDockArt());
	wxAuiPaneInfo p_inf;

	// Set icon
	string icon_filename = App::path("slade.ico", App::Dir::Temp);
	theArchiveManager->programResourceArchive()->getEntry("slade.ico")->exportFile(icon_filename);
	SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
	wxRemoveFile(icon_filename);


	// -- Editor Area --
	stc_tabs = new STabCtrl(this, true, true, tabs_condensed ? 27 : 31, true, true);

	// Setup panel info & add panel
	p_inf.CenterPane();
	p_inf.Name("editor_area");
	p_inf.PaneBorder(false);
	m_mgr->AddPane(stc_tabs, p_inf);

	// Create Start Page
#ifdef USE_WEBVIEW_STARTPAGE
	html_startpage = wxWebView::New(stc_tabs, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxWebViewBackendDefault, wxBORDER_NONE);
	html_startpage->SetName("startpage");
#ifdef __WXMAC__
	html_startpage->SetZoomType(wxWEBVIEW_ZOOM_TYPE_TEXT);
#else // !__WXMAC__
	html_startpage->SetZoomType(wxWEBVIEW_ZOOM_TYPE_LAYOUT);
#endif // __WXMAC__
	if (show_start_page)
	{
		stc_tabs->AddPage(html_startpage,"Start Page");
		stc_tabs->SetPageBitmap(0, Icons::getIcon(Icons::GENERAL, "logo"));
		createStartPage();
	}
	else
		html_startpage->Show(false);
#else
	html_startpage = new wxHtmlWindow(stc_tabs, -1, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER, "startpage");
	html_startpage->SetName("startpage");
	if (show_start_page)
	{
		stc_tabs->AddPage(html_startpage, "Start Page");
		stc_tabs->SetPageBitmap(0, Icons::getIcon(Icons::GENERAL, "logo"));
		createStartPage();
	}
	else
		html_startpage->Show(false);
#endif


	// -- Console Panel --
	ConsolePanel* panel_console = new ConsolePanel(this, -1);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Float();
	p_inf.FloatingSize(600, 400);
	p_inf.FloatingPosition(100, 100);
	p_inf.MinSize(-1, 192);
	p_inf.Show(false);
	p_inf.Caption("Console");
	p_inf.Name("console");
	m_mgr->AddPane(panel_console, p_inf);


	// -- Archive Manager Panel --
	panel_archivemanager = new ArchiveManagerPanel(this, stc_tabs);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Left();
	p_inf.BestSize(192, 480);
	p_inf.Caption("Archive Manager");
	p_inf.Name("archive_manager");
	p_inf.Show(true);
	p_inf.Dock();
	m_mgr->AddPane(panel_archivemanager, p_inf);


	// -- Undo History Panel --
	panel_undo_history = new UndoManagerHistoryPanel(this, nullptr);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Right();
	p_inf.BestSize(128, 480);
	p_inf.Caption("Undo History");
	p_inf.Name("undo_history");
	p_inf.Show(false);
	p_inf.Dock();
	m_mgr->AddPane(panel_undo_history, p_inf);


	// -- Menu bar --
	wxMenuBar* menu = new wxMenuBar();
	menu->SetThemeEnabled(false);

	// File menu
	wxMenu* fileNewMenu = new wxMenu("");
	SAction::fromId("aman_newwad")->addToMenu(fileNewMenu, "&Wad Archive");
	SAction::fromId("aman_newzip")->addToMenu(fileNewMenu, "&Zip Archive");
	SAction::fromId("aman_newmap")->addToMenu(fileNewMenu, "&Map");
	wxMenu* fileMenu = new wxMenu("");
	fileMenu->AppendSubMenu(fileNewMenu, "&New", "Create a new Archive");
	SAction::fromId("aman_open")->addToMenu(fileMenu);
	SAction::fromId("aman_opendir")->addToMenu(fileMenu);
	fileMenu->AppendSeparator();
	SAction::fromId("aman_save")->addToMenu(fileMenu);
	SAction::fromId("aman_saveas")->addToMenu(fileMenu);
	SAction::fromId("aman_saveall")->addToMenu(fileMenu);
	fileMenu->AppendSubMenu(panel_archivemanager->getRecentMenu(), "&Recent Files");
	fileMenu->AppendSeparator();
	SAction::fromId("aman_close")->addToMenu(fileMenu);
	SAction::fromId("aman_closeall")->addToMenu(fileMenu);
	fileMenu->AppendSeparator();
	SAction::fromId("main_exit")->addToMenu(fileMenu);
	menu->Append(fileMenu, "&File");

	// Edit menu
	wxMenu* editorMenu = new wxMenu("");
	SAction::fromId("main_undo")->addToMenu(editorMenu);
	SAction::fromId("main_redo")->addToMenu(editorMenu);
	editorMenu->AppendSeparator();
	SAction::fromId("main_setbra")->addToMenu(editorMenu);
	SAction::fromId("main_preferences")->addToMenu(editorMenu);
	menu->Append(editorMenu, "E&dit");

	// View menu
	wxMenu* viewMenu = new wxMenu("");
	SAction::fromId("main_showam")->addToMenu(viewMenu);
	SAction::fromId("main_showconsole")->addToMenu(viewMenu);
	SAction::fromId("main_showundohistory")->addToMenu(viewMenu);
	menu->Append(viewMenu, "&View");

	// Help menu
	wxMenu* helpMenu = new wxMenu("");
	SAction::fromId("main_onlinedocs")->addToMenu(helpMenu);
	SAction::fromId("main_about")->addToMenu(helpMenu);
#ifdef __WXMSW__
	SAction::fromId("main_updatecheck")->addToMenu(helpMenu);
#endif
	menu->Append(helpMenu, "&Help");

	// Set the menu
	SetMenuBar(menu);



	// -- Toolbars --
	toolbar = new SToolBar(this, true);

	// Create File toolbar
	SToolBarGroup* tbg_file = new SToolBarGroup(toolbar, "_File");
	tbg_file->addActionButton("aman_newwad");
	tbg_file->addActionButton("aman_newzip");
	tbg_file->addActionButton("aman_open");
	tbg_file->addActionButton("aman_opendir");
	tbg_file->addActionButton("aman_save");
	tbg_file->addActionButton("aman_saveas");
	tbg_file->addActionButton("aman_saveall");
	tbg_file->addActionButton("aman_close");
	tbg_file->addActionButton("aman_closeall");
	toolbar->addGroup(tbg_file);

	// Create Archive toolbar
	SToolBarGroup* tbg_archive = new SToolBarGroup(toolbar, "_Archive");
	tbg_archive->addActionButton("arch_newentry");
	tbg_archive->addActionButton("arch_newdir");
	tbg_archive->addActionButton("arch_importfiles");
	tbg_archive->addActionButton("arch_texeditor");
	tbg_archive->addActionButton("arch_mapeditor");
	tbg_archive->addActionButton("arch_run");
	toolbar->addGroup(tbg_archive);

	// Create Entry toolbar
	SToolBarGroup* tbg_entry = new SToolBarGroup(toolbar, "_Entry");
	tbg_entry->addActionButton("arch_entry_rename");
	tbg_entry->addActionButton("arch_entry_delete");
	tbg_entry->addActionButton("arch_entry_import");
	tbg_entry->addActionButton("arch_entry_export");
	tbg_entry->addActionButton("arch_entry_moveup");
	tbg_entry->addActionButton("arch_entry_movedown");
	toolbar->addGroup(tbg_entry);

	// Create Base Resource Archive toolbar
	SToolBarGroup* tbg_bra = new SToolBarGroup(toolbar, "_Base Resource", true);
	BaseResourceChooser* brc = new BaseResourceChooser(tbg_bra);
	tbg_bra->addCustomControl(brc);
	tbg_bra->addActionButton("main_setbra", "settings");
	toolbar->addGroup(tbg_bra);

	// Create Palette Chooser toolbar
	SToolBarGroup* tbg_palette = new SToolBarGroup(toolbar, "_Palette", true);
	palette_chooser = new PaletteChooser(tbg_palette, -1);
	palette_chooser->selectPalette(global_palette);
	tbg_palette->addCustomControl(palette_chooser);
	toolbar->addGroup(tbg_palette);

	// Archive and Entry toolbars are initially disabled
	toolbar->enableGroup("_archive", false);
	toolbar->enableGroup("_entry", false);

	// Add toolbar
	m_mgr->AddPane(toolbar, wxAuiPaneInfo().Top().CaptionVisible(false).MinSize(-1, SToolBar::getBarHeight()).Resizable(false).PaneBorder(false).Name("toolbar"));


	// -- Status Bar --
	CreateStatusBar(3);


	// Load previously saved perspective string
	loadLayout();

	// Finalize
	m_mgr->Update();
	Layout();

	// Bind events
#ifdef USE_WEBVIEW_STARTPAGE
	html_startpage->Bind(wxEVT_WEBVIEW_NAVIGATING, &MainWindow::onHTMLLinkClicked, this);
#else
	html_startpage->Bind(wxEVT_COMMAND_HTML_LINK_CLICKED, &MainWindow::onHTMLLinkClicked, this);
#endif
	Bind(wxEVT_SIZE, &MainWindow::onSize, this);
	Bind(wxEVT_CLOSE_WINDOW, &MainWindow::onClose, this);
	Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, &MainWindow::onTabChanged, this);
	Bind(wxEVT_STOOLBAR_LAYOUT_UPDATED, &MainWindow::onToolBarLayoutChanged, this, toolbar->GetId());
	Bind(wxEVT_ACTIVATE, &MainWindow::onActivate, this);

	// Initial focus to toolbar
	toolbar->SetFocus();
}
Ejemplo n.º 14
0
// -----------------------------------------------------------------------------
// Sets up the wxWidgets window layout
// -----------------------------------------------------------------------------
void MainWindow::setupLayout()
{
	// Create the wxAUI manager & related things
	aui_mgr_ = new wxAuiManager(this);
	aui_mgr_->SetArtProvider(new SAuiDockArt());
	wxAuiPaneInfo p_inf;

	// Set icon
	auto icon_filename = App::path(App::iconFile(), App::Dir::Temp);
	App::archiveManager().programResourceArchive()->entry(App::iconFile())->exportFile(icon_filename);
	SetIcon(wxIcon(icon_filename, wxBITMAP_TYPE_ICO));
	wxRemoveFile(icon_filename);


	// -- Editor Area --
	stc_tabs_ = new STabCtrl(this, true, true, tabs_condensed ? 27 : 31, true, true);

	// Setup panel info & add panel
	p_inf.CenterPane();
	p_inf.Name("editor_area");
	p_inf.PaneBorder(false);
	aui_mgr_->AddPane(stc_tabs_, p_inf);

	// Create Start Page
	start_page_ = new SStartPage(stc_tabs_);
	if (show_start_page)
	{
		stc_tabs_->AddPage(start_page_, "Start Page");
		stc_tabs_->SetPageBitmap(0, Icons::getIcon(Icons::General, "logo"));
		start_page_->init();
		createStartPage();
	}
	else
		start_page_->Show(false);

	// -- Console Panel --
	auto panel_console = new ConsolePanel(this, -1);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Float();
	p_inf.FloatingSize(WxUtils::scaledSize(600, 400));
	p_inf.FloatingPosition(WxUtils::scaledPoint(100, 100));
	p_inf.MinSize(WxUtils::scaledSize(-1, 192));
	p_inf.Show(false);
	p_inf.Caption("Console");
	p_inf.Name("console");
	aui_mgr_->AddPane(panel_console, p_inf);


	// -- Archive Manager Panel --
	panel_archivemanager_ = new ArchiveManagerPanel(this, stc_tabs_);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Left();
	p_inf.BestSize(WxUtils::scaledSize(192, 480));
	p_inf.Caption("Archive Manager");
	p_inf.Name("archive_manager");
	p_inf.Show(true);
	p_inf.Dock();
	aui_mgr_->AddPane(panel_archivemanager_, p_inf);


	// -- Undo History Panel --
	panel_undo_history_ = new UndoManagerHistoryPanel(this, nullptr);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Right();
	p_inf.BestSize(WxUtils::scaledSize(128, 480));
	p_inf.Caption("Undo History");
	p_inf.Name("undo_history");
	p_inf.Show(false);
	p_inf.Dock();
	aui_mgr_->AddPane(panel_undo_history_, p_inf);


	// -- Menu bar --
	auto menu = new wxMenuBar();
	menu->SetThemeEnabled(false);

	// File menu
	auto file_new_menu = new wxMenu("");
	SAction::fromId("aman_newwad")->addToMenu(file_new_menu, "&Wad Archive");
	SAction::fromId("aman_newzip")->addToMenu(file_new_menu, "&Zip Archive");
	SAction::fromId("aman_newmap")->addToMenu(file_new_menu, "&Map");
	auto file_menu = new wxMenu("");
	file_menu->AppendSubMenu(file_new_menu, "&New", "Create a new Archive");
	SAction::fromId("aman_open")->addToMenu(file_menu);
	SAction::fromId("aman_opendir")->addToMenu(file_menu);
	file_menu->AppendSeparator();
	SAction::fromId("aman_save")->addToMenu(file_menu);
	SAction::fromId("aman_saveas")->addToMenu(file_menu);
	SAction::fromId("aman_saveall")->addToMenu(file_menu);
	file_menu->AppendSubMenu(panel_archivemanager_->getRecentMenu(), "&Recent Files");
	file_menu->AppendSeparator();
	SAction::fromId("aman_close")->addToMenu(file_menu);
	SAction::fromId("aman_closeall")->addToMenu(file_menu);
	file_menu->AppendSeparator();
	SAction::fromId("main_exit")->addToMenu(file_menu);
	menu->Append(file_menu, "&File");

	// Edit menu
	auto editor_menu = new wxMenu("");
	SAction::fromId("main_undo")->addToMenu(editor_menu);
	SAction::fromId("main_redo")->addToMenu(editor_menu);
	editor_menu->AppendSeparator();
	SAction::fromId("main_setbra")->addToMenu(editor_menu);
	SAction::fromId("main_preferences")->addToMenu(editor_menu);
	menu->Append(editor_menu, "E&dit");

	// View menu
	auto view_menu = new wxMenu("");
	SAction::fromId("main_showam")->addToMenu(view_menu);
	SAction::fromId("main_showconsole")->addToMenu(view_menu);
	SAction::fromId("main_showundohistory")->addToMenu(view_menu);
	SAction::fromId("main_showstartpage")->addToMenu(view_menu);
	toolbar_menu_ = new wxMenu();
	view_menu->AppendSubMenu(toolbar_menu_, "Toolbars");
	menu->Append(view_menu, "&View");

	// Tools menu
	auto tools_menu = new wxMenu("");
	SAction::fromId("main_runscript")->addToMenu(tools_menu);
	menu->Append(tools_menu, "&Tools");

	// Help menu
	auto help_menu = new wxMenu("");
	SAction::fromId("main_onlinedocs")->addToMenu(help_menu);
	SAction::fromId("main_about")->addToMenu(help_menu);
#ifdef __WXMSW__
	SAction::fromId("main_updatecheck")->addToMenu(help_menu);
#endif
	menu->Append(help_menu, "&Help");

	// Set the menu
	SetMenuBar(menu);



	// -- Toolbars --
	toolbar_ = new SToolBar(this, true);

	// Create File toolbar
	auto tbg_file = new SToolBarGroup(toolbar_, "_File");
	tbg_file->addActionButton("aman_newwad");
	tbg_file->addActionButton("aman_newzip");
	tbg_file->addActionButton("aman_open");
	tbg_file->addActionButton("aman_opendir");
	tbg_file->addActionButton("aman_save");
	tbg_file->addActionButton("aman_saveas");
	tbg_file->addActionButton("aman_saveall");
	tbg_file->addActionButton("aman_close");
	tbg_file->addActionButton("aman_closeall");
	toolbar_->addGroup(tbg_file);

	// Create Archive toolbar
	auto tbg_archive = new SToolBarGroup(toolbar_, "_Archive");
	tbg_archive->addActionButton("arch_newentry");
	tbg_archive->addActionButton("arch_newdir");
	tbg_archive->addActionButton("arch_importfiles");
	tbg_archive->addActionButton("arch_texeditor");
	tbg_archive->addActionButton("arch_mapeditor");
	tbg_archive->addActionButton("arch_run");
	toolbar_->addGroup(tbg_archive);

	// Create Entry toolbar
	auto tbg_entry = new SToolBarGroup(toolbar_, "_Entry");
	tbg_entry->addActionButton("arch_entry_rename");
	tbg_entry->addActionButton("arch_entry_delete");
	tbg_entry->addActionButton("arch_entry_import");
	tbg_entry->addActionButton("arch_entry_export");
	tbg_entry->addActionButton("arch_entry_moveup");
	tbg_entry->addActionButton("arch_entry_movedown");
	toolbar_->addGroup(tbg_entry);

	// Create Base Resource Archive toolbar
	auto tbg_bra = new SToolBarGroup(toolbar_, "_Base Resource", true);
	auto brc     = new BaseResourceChooser(tbg_bra);
	tbg_bra->addCustomControl(brc);
	tbg_bra->addActionButton("main_setbra", "settings");
	toolbar_->addGroup(tbg_bra);

	// Create Palette Chooser toolbar
	auto tbg_palette = new SToolBarGroup(toolbar_, "_Palette", true);
	palette_chooser_ = new PaletteChooser(tbg_palette, -1);
	palette_chooser_->selectPalette(global_palette);
	tbg_palette->addCustomControl(palette_chooser_);
	toolbar_->addGroup(tbg_palette);

	// Archive and Entry toolbars are initially disabled
	toolbar_->enableGroup("_archive", false);
	toolbar_->enableGroup("_entry", false);

	// Add toolbar
	aui_mgr_->AddPane(
		toolbar_,
		wxAuiPaneInfo()
			.Top()
			.CaptionVisible(false)
			.MinSize(-1, SToolBar::getBarHeight())
			.Resizable(false)
			.PaneBorder(false)
			.Name("toolbar"));

	// Populate the 'View->Toolbars' menu
	populateToolbarsMenu();
	toolbar_->enableContextMenu();

	// -- Status Bar --
	CreateStatusBar(3);


	// Load previously saved perspective string
	loadLayout();

	// Finalize
	aui_mgr_->Update();
	Layout();

	// Bind events
	Bind(wxEVT_SIZE, &MainWindow::onSize, this);
	Bind(wxEVT_CLOSE_WINDOW, &MainWindow::onClose, this);
	Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, &MainWindow::onTabChanged, this);
	Bind(wxEVT_STOOLBAR_LAYOUT_UPDATED, &MainWindow::onToolBarLayoutChanged, this, toolbar_->GetId());
	Bind(wxEVT_ACTIVATE, &MainWindow::onActivate, this);
	Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSE, [&](wxAuiNotebookEvent& e) {
		// Null start_page pointer if start page tab is closed
		auto page = stc_tabs_->GetPage(stc_tabs_->GetSelection());
		if (page->GetName() == "startpage")
			start_page_ = nullptr;
	});

	// Initial focus to toolbar
	toolbar_->SetFocus();
}
Ejemplo n.º 15
0
/* MapEditorWindow::setupLayout
 * Sets up the basic map editor window layout
 *******************************************************************/
void MapEditorWindow::setupLayout()
{
	// Create the wxAUI manager & related things
	wxAuiManager* m_mgr = new wxAuiManager(this);
	m_mgr->SetArtProvider(new SAuiDockArt());
	wxAuiPaneInfo p_inf;

	// Map canvas
	map_canvas = new MapCanvas(this, -1, &editor);
	p_inf.CenterPane();
	m_mgr->AddPane(map_canvas, p_inf);

	// --- Menus ---
	setupMenu();


	// --- Toolbars ---
	toolbar = new SToolBar(this, true);

	// Map toolbar
	SToolBarGroup* tbg_map = new SToolBarGroup(toolbar, "_Map");
	tbg_map->addActionButton("mapw_save");
	tbg_map->addActionButton("mapw_saveas");
	tbg_map->addActionButton("mapw_rename");
	toolbar->addGroup(tbg_map);

	// Mode toolbar
	SToolBarGroup* tbg_mode = new SToolBarGroup(toolbar, "_Mode");
	tbg_mode->addActionButton("mapw_mode_vertices");
	tbg_mode->addActionButton("mapw_mode_lines");
	tbg_mode->addActionButton("mapw_mode_sectors");
	tbg_mode->addActionButton("mapw_mode_things");
	tbg_mode->addActionButton("mapw_mode_3d");
	theApp->toggleAction("mapw_mode_lines");	// Lines mode by default
	toolbar->addGroup(tbg_mode);

	// Flat type toolbar
	SToolBarGroup* tbg_flats = new SToolBarGroup(toolbar, "_Flats Type");
	tbg_flats->addActionButton("mapw_flat_none");
	tbg_flats->addActionButton("mapw_flat_untextured");
	tbg_flats->addActionButton("mapw_flat_textured");
	toolbar->addGroup(tbg_flats);

	// Toggle current flat type
	if (flat_drawtype == 0) theApp->toggleAction("mapw_flat_none");
	else if (flat_drawtype == 1) theApp->toggleAction("mapw_flat_untextured");
	else theApp->toggleAction("mapw_flat_textured");

	// Edit toolbar
	SToolBarGroup* tbg_edit = new SToolBarGroup(toolbar, "_Edit");
	tbg_edit->addActionButton("mapw_draw_lines");
	tbg_edit->addActionButton("mapw_draw_shape");
	tbg_edit->addActionButton("mapw_edit_objects");
	tbg_edit->addActionButton("mapw_mirror_x");
	tbg_edit->addActionButton("mapw_mirror_y");
	toolbar->addGroup(tbg_edit);

	// Extra toolbar
	SToolBarGroup* tbg_misc = new SToolBarGroup(toolbar, "_Misc");
	tbg_misc->addActionButton("mapw_run_map");
	toolbar->addGroup(tbg_misc);

	// Add toolbar
	m_mgr->AddPane(toolbar, wxAuiPaneInfo().Top().CaptionVisible(false).MinSize(-1, SToolBar::getBarHeight()).Resizable(false).PaneBorder(false).Name("toolbar"));


	// Status bar
	CreateStatusBar(4);
	int status_widths[4] = { -1, 240, 200, 160 };
	SetStatusWidths(4, status_widths);

	// -- Console Panel --
	ConsolePanel* panel_console = new ConsolePanel(this, -1);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Bottom();
	p_inf.Dock();
	p_inf.BestSize(480, 192);
	p_inf.FloatingSize(600, 400);
	p_inf.FloatingPosition(100, 100);
	p_inf.MinSize(-1, 192);
	p_inf.Show(false);
	p_inf.Caption("Console");
	p_inf.Name("console");
	m_mgr->AddPane(panel_console, p_inf);


	// -- Map Object Properties Panel --
	panel_obj_props = new MapObjectPropsPanel(this);

	// Setup panel info & add panel
	p_inf.Right();
	p_inf.BestSize(256, 256);
	p_inf.FloatingSize(400, 600);
	p_inf.FloatingPosition(120, 120);
	p_inf.MinSize(256, 256);
	p_inf.Show(true);
	p_inf.Caption("Item Properties");
	p_inf.Name("item_props");
	m_mgr->AddPane(panel_obj_props, p_inf);


	// --- Script Editor Panel ---
	panel_script_editor = new ScriptEditorPanel(this);

	// Setup panel info & add panel
	p_inf.Float();
	p_inf.BestSize(300, 300);
	p_inf.FloatingSize(500, 400);
	p_inf.FloatingPosition(150, 150);
	p_inf.MinSize(300, 300);
	p_inf.Show(false);
	p_inf.Caption("Script Editor");
	p_inf.Name("script_editor");
	m_mgr->AddPane(panel_script_editor, p_inf);


	// --- Shape Draw Options Panel ---
	ShapeDrawPanel* panel_shapedraw = new ShapeDrawPanel(this);

	// Setup panel info & add panel
	wxSize msize = panel_shapedraw->GetMinSize();
	p_inf.DefaultPane();
	p_inf.Bottom();
	p_inf.Dock();
	p_inf.CloseButton(false);
	p_inf.CaptionVisible(false);
	p_inf.Resizable(false);
	p_inf.Layer(2);
	p_inf.BestSize(msize.x, msize.y);
	p_inf.FloatingSize(msize.x, msize.y);
	p_inf.FloatingPosition(140, 140);
	p_inf.MinSize(msize.x, msize.y);
	p_inf.Show(false);
	p_inf.Caption("Shape Drawing");
	p_inf.Name("shape_draw");
	m_mgr->AddPane(panel_shapedraw, p_inf);


	// --- Object Edit Panel ---
	panel_obj_edit = new ObjectEditPanel(this);

	// Setup panel info & add panel
	msize = panel_obj_edit->GetBestSize();

	p_inf.Bottom();
	p_inf.Dock();
	p_inf.CloseButton(false);
	p_inf.CaptionVisible(false);
	p_inf.Resizable(false);
	p_inf.Layer(2);
	p_inf.BestSize(msize.x, msize.y);
	p_inf.FloatingSize(msize.x, msize.y);
	p_inf.FloatingPosition(140, 140);
	p_inf.MinSize(msize.x, msize.y);
	p_inf.Show(false);
	p_inf.Caption("Object Edit");
	p_inf.Name("object_edit");
	m_mgr->AddPane(panel_obj_edit, p_inf);


	// --- Map Checks Panel ---
	panel_checks = new MapChecksPanel(this, &(editor.getMap()));

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Left();
	p_inf.Dock();
	p_inf.BestSize(400, 300);
	p_inf.FloatingSize(500, 400);
	p_inf.FloatingPosition(160, 160);
	p_inf.MinSize(300, 300);
	p_inf.Show(false);
	p_inf.Caption("Map Checks");
	p_inf.Name("map_checks");
	p_inf.Layer(0);
	m_mgr->AddPane(panel_checks, p_inf);


	// -- Undo History Panel --
	panel_undo_history = new UndoManagerHistoryPanel(this, NULL);
	panel_undo_history->setManager(editor.undoManager());

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Right();
	p_inf.BestSize(128, 480);
	p_inf.Caption("Undo History");
	p_inf.Name("undo_history");
	p_inf.Show(false);
	p_inf.Dock();
	m_mgr->AddPane(panel_undo_history, p_inf);


	// Load previously saved window layout
	loadLayout();

	m_mgr->Update();
	Layout();

	// Initial focus on the canvas, so shortcuts work
	map_canvas->SetFocus();
}
CWBOOL cwD3D11LayoutsManager::init()
{
	loadLayout();

	return CWTRUE;
}
Ejemplo n.º 17
0
void defaultLayout()
{
  loadLayout(0);
}
Ejemplo n.º 18
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //restoreGeometry( opts.mainwindowgeometry);
    //restoreState( opts.windowstate );

    setupStatusBar();

    satlist = new SatelliteList();
    seglist = new AVHRRSatellite(this, satlist);


    formephem = new FormEphem(this, satlist, seglist);
    ui->stackedWidget->addWidget(formephem); // index 0

    formtoolbox = NULL;

    formgeostationary = new FormGeostationary(this, satlist, seglist);
    ui->stackedWidget->addWidget(formgeostationary); // index 1

    cylequidist = new CylEquiDist( opts.backgroundimage2D );
    mapcyl = new MapFieldCyl(this, cylequidist, satlist, seglist);
    globe = new Globe(this, satlist, seglist);

    formimage = new FormImage(this, satlist, seglist);
    imagescrollarea = new  ImageScrollArea();
    imagescrollarea->setBackgroundRole(QPalette::Dark);
    imagescrollarea->setWidget(formimage);

    formgeostationary->SetFormImage(formimage);
    connect(formimage, SIGNAL(moveImage(QPoint, QPoint)), this, SLOT(moveImage(QPoint, QPoint)));

    for( int i = 0; i < 8; i++)
    {
        connect(&seglist->seglmeteosat->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglmeteosat->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglmeteosat->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    for( int i = 0; i < 24; i++)
    {
        connect(&seglist->seglmeteosat->watcherHRV[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }


    for( int i = 0; i < 8; i++)
    {
        connect(&seglist->seglmeteosatrss->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglmeteosatrss->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglmeteosatrss->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    for( int i = 0; i < 24; i++)
    {
        connect(&seglist->seglmeteosatrss->watcherHRV[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    for( int i = 0; i < 8; i++)
    {
        connect(&seglist->seglmet8->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglmet8->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglmet8->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    for( int i = 0; i < 24; i++)
    {
        connect(&seglist->seglmet8->watcherHRV[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }


    for( int i = 0; i < 10; i++)
    {
        connect(&seglist->seglmet7->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    for( int i = 0; i < 7; i++)
    {
        connect(&seglist->seglgoes13dc3->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }
    for( int i = 0; i < 7; i++)
    {
        connect(&seglist->seglgoes15dc3->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    for( int i = 0; i < 7; i++)
    {
        connect(&seglist->seglgoes13dc4->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }
    for( int i = 0; i < 7; i++)
    {
        connect(&seglist->seglgoes15dc4->watcherMono[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    connect(seglist->seglfy2e, SIGNAL(imagefinished()), formimage, SLOT(slotUpdateMeteosat()));
    connect(seglist->seglfy2g, SIGNAL(imagefinished()), formimage, SLOT(slotUpdateMeteosat()));

    for( int i = 0; i < 10; i++)
    {
        connect(&seglist->seglh8->watcherRed[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglh8->watcherGreen[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
        connect(&seglist->seglh8->watcherBlue[i], SIGNAL(finished()), formimage, SLOT(slotUpdateMeteosat()));
    }

    imageptrs->gvp = new GeneralVerticalPerspective(this, seglist);
    imageptrs->lcc = new LambertConformalConic(this, seglist);
    imageptrs->sg = new StereoGraphic(this, seglist);

    QMainWindow::setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    QMainWindow::setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    QMainWindow::setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    QMainWindow::setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);

    forminfrascales = new FormInfraScales();
    formtoolbox = new FormToolbox(this, formimage, formgeostationary, forminfrascales, seglist);

    formimage->SetFormToolbox(formtoolbox);
    formgeostationary->SetFormToolBox(formtoolbox);

    connect(seglist->seglmeteosat, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglmeteosatrss, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglmet8, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglmet7, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglgoes13dc3, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglgoes15dc3, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglgoes13dc4, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglgoes15dc4, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglfy2e, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglfy2g, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglh8, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglviirsm, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglviirsdnb, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglolciefr, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglolcierr, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglmetop, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglnoaa, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglhrp, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist->seglgac, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));
    connect(seglist, SIGNAL(progressCounter(int)), formtoolbox, SLOT(setValueProgressBar(int)));

    connect(seglist->seglviirsdnb, SIGNAL(displayDNBGraph()), formtoolbox, SLOT(slotDisplayDNBGraph()));


    formglobecyl = new FormMapCyl( this, mapcyl, globe, formtoolbox, satlist, seglist);

    connect(seglist, SIGNAL(signalNothingSelected()), formglobecyl, SLOT(slotNothingSelected()));

    createDockWidget();

    forminfrascales->setFormImage(formimage);

    addDockWidget(Qt::BottomDockWidgetArea, forminfrascales);
    forminfrascales->hide();

    formimage->SetDockWidgetInfraScales(forminfrascales);

    ui->stackedWidget->addWidget(formglobecyl);  // index 2

    ui->stackedWidget->addWidget(imagescrollarea);  // index 3
    ui->stackedWidget->setCurrentIndex(0);

    connect(seglist->seglmetop, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglnoaa, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglhrp, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglgac, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglviirsm, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglviirsdnb, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabelDNB(bool)));
    connect(seglist->seglolciefr, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglolcierr, SIGNAL(segmentlistfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));

    connect(seglist->seglmetop, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglnoaa, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglhrp, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglgac, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglviirsm, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglviirsdnb, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglolciefr, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));
    connect(seglist->seglolcierr, SIGNAL(segmentprojectionfinished(bool)), formimage, SLOT(setPixmapToLabel(bool)));


    connect( formglobecyl, SIGNAL(signalSegmentChanged(QString)), this, SLOT(updateStatusBarIndicator(QString)) );
    connect( ui->stackedWidget, SIGNAL(currentChanged(int)),formglobecyl, SLOT(updatesatmap(int)) );
    connect( formephem,SIGNAL(signalDirectoriesRead()), formgeostationary, SLOT(PopulateTree()) );
    connect( seglist,SIGNAL(signalAddedSegmentlist()), formephem, SLOT(showSegmentsAdded()));

    connect( formephem,SIGNAL(signalDirectoriesRead()), formglobecyl, SLOT(setScrollBarMaximum()));
    connect( formglobecyl, SIGNAL(emitMakeImage()), formimage, SLOT(slotMakeImage()));
    connect( formtoolbox, SIGNAL(emitShowVIIRSImage()), formimage, SLOT(slotShowVIIRSMImage()));
    connect( formtoolbox, SIGNAL(emitShowOLCIefrImage()), formimage, SLOT(slotShowOLCIefrImage()));
    connect( formtoolbox, SIGNAL(emitShowOLCIerrImage()), formimage, SLOT(slotShowOLCIerrImage()));

    connect( globe , SIGNAL(mapClicked()), formephem, SLOT(showSelectedSegmentList()));
    connect( mapcyl , SIGNAL(mapClicked()), formephem, SLOT(showSelectedSegmentList()));

    connect( formephem, SIGNAL(signalDatagram(QByteArray)), seglist, SLOT(AddSegmentsToListFromUdp(QByteArray)));

    connect( formimage, SIGNAL(render3dgeo(SegmentListGeostationary::eGeoSatellite)), globe, SLOT(Render3DGeo(SegmentListGeostationary::eGeoSatellite)));
    connect( formimage, SIGNAL(allsegmentsreceivedbuttons(bool)), formtoolbox, SLOT(setToolboxButtons(bool)));
    connect( globe, SIGNAL(renderingglobefinished(bool)), formtoolbox, SLOT(setToolboxButtons(bool)));

    connect( formgeostationary, SIGNAL(geostationarysegmentschosen(SegmentListGeostationary::eGeoSatellite, QStringList)), formtoolbox, SLOT(geostationarysegmentsChosen(SegmentListGeostationary::eGeoSatellite, QStringList)));
    connect( formtoolbox, SIGNAL(getmeteosatchannel(QString, QVector<QString>, QVector<bool>)), formgeostationary, SLOT(CreateGeoImage(QString, QVector<QString>, QVector<bool>)));
    connect( formtoolbox, SIGNAL(screenupdateprojection()), formimage, SLOT(slotUpdateProjection()));
    connect( formtoolbox, SIGNAL(switchstackedwidget(int)), this, SLOT(slotSwitchStackedWindow(int)));

    connect( formgeostationary, SIGNAL(enabletoolboxbuttons(bool)), formtoolbox, SLOT(setToolboxButtons(bool)));

    formtoolbox->setChannelIndex();

    setWindowTitle(tr("EUMETCast Viewer"));
    timer = new QTimer( this );
    timer->start( 1000);
    connect(timer, SIGNAL(timeout()), formephem, SLOT(timerDone()));
    connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));

    herr_t  h5_status;
    unsigned int majnum;
    unsigned int minnum;
    unsigned int relnum;

    h5_status = H5get_libversion(&majnum, &minnum, &relnum);

    qDebug() << QString("HDF5 library %1.%2.%3").arg(majnum).arg(minnum).arg(relnum);


    loadLayout();
}
Ejemplo n.º 19
0
void BaseLayout::initialise(MyGUI::WidgetPtr _parent)
{
	loadLayout(_parent);
}
Ejemplo n.º 20
0
void BaseLayout::initialise()
{
	loadLayout();
}
Ejemplo n.º 21
0
boost::shared_ptr<Widget> Loader::loadWidget(const pugi::xml_node &from) {
    boost::shared_ptr<Widget> ret;

    std::string type = from.attribute("type").as_string("");
    if(type == "") {
        Message3(GUI, Error, "Widget element missing type");
        return boost::shared_ptr<Widget>();
    }

    // common elements
    Math::Vector minSize;

    auto snode = from.child("stretch");
    Math::Vector stretch(snode.attribute("x").as_double(1.0),
        snode.attribute("y").as_double(1.0));

    if(type == "panel") {
        auto lnode = from.child("layout");
        if(!lnode) {
            Message3(GUI, Error, "Panel element missing layout");
            return boost::shared_ptr<Widget>();
        }

        boost::shared_ptr<Layout> layout = loadLayout(lnode);
        if(!layout) {
            Message3(GUI, Error, "Panel layout loading failed");
            return boost::shared_ptr<Widget>();
        }

        for(auto wnode = from.child("widget"); wnode;
            wnode = wnode.next_sibling()) {
            
            //Message3(GUI, Debug, "Widget sibling");
            auto widget = loadWidget(wnode);
            if(widget) layout->addItem(widget);
        }

        ret = boost::make_shared<Panel>(minSize, stretch, layout);
    }
    // elements common to labels/buttons
    else if(type == "label" || type == "button") {
        auto fnode = from.child("font");
        std::string fontName = fnode.text().as_string("");
        if(fontName == "") {
            Message3(GUI, Error, "Label font empty");
            return boost::shared_ptr<Widget>();
        }

        auto tnode = from.child("text");
        std::string text = tnode.text().as_string("");

        if(type == "label") {
            Message3(GUI, Fatal, "Label loading stubbed out");
            /*ret = boost::make_shared<Label>(minSize, stretch,
                ResourceRegistry::get<Font>(fontName), text);*/
        }
        else {
            Message3(GUI, Fatal, "Button loading stubbed out");
            /*ret = boost::make_shared<Button>(minSize, stretch,
                ResourceRegistry::get<Font>(fontName), text);*/
        }
    }
    else {
        Message3(GUI, Error, "Unknown GUI element type " << type);
    }

    std::string name = from.attribute("name").as_string("");
    if(name != "") m_namedWidgets[name] = ret;

    return ret;
}