Ejemplo n.º 1
0
void TrackPropDlg::OnOKBtnClick( wxCommandEvent& event )
{
    //    Look in the route list to be sure the route is still available
    //    (May have been deleted by RouteManagerDialog...)

    bool b_found_route = false;
    wxRouteListNode *node = pRouteList->GetFirst();
    while( node ) {
        Route *proute = node->GetData();

        if( proute == m_pRoute ) {
            b_found_route = true;
            break;
        }
        node = node->GetNext();
    }

    if( b_found_route ) {
        SaveChanges();              // write changes to globals and update config
        m_pRoute->ClearHighlights();
    }

    m_pEnroutePoint = NULL;
    m_bStartNow = false;

    if( pRouteManagerDialog && pRouteManagerDialog->IsShown() )
        pRouteManagerDialog->UpdateTrkListCtrl();
    
    Hide();
    cc1->Refresh( false );

    event.Skip();
}
Ejemplo n.º 2
0
void  KPstateAudioSettings::MouseClick(KPstateContext *pContext,
                                       MouseButton button,
                                       MouseButtonEvent event,
                                       int x, int y)
{
    auto signal = KPstate::EvaluateMouseClick(pContext, button, event, x, y);

    switch (signal)
    {
        case Signal::ToggleSoundVolume:
            ToggleSoundVolume(pContext);
            break;

        case Signal::ToggleMusicVolume:
            ToggleMusicVolume(pContext);
            break;

        case Signal::Back:
            SaveChanges(pContext);
            pContext->ChangeState(pContext->GetPreviousState());
            return;

        default:
            return;
    }

    UpdateDisplay(pContext);
}
Ejemplo n.º 3
0
void PathProp::OnPathPropOkClick( wxCommandEvent& event )
{
    //    Look in the path list to be sure the path is still available
    //    (May have been deleted by PathManagerDialog...)

    wxPathListNode *node = g_pPathList->GetFirst();
    while( node ) {
        Path *pPath = node->GetData();

        if( pPath == m_pPath ) {
            m_pPath->m_iBlink--;
            SaveChanges();              // write changes to globals and update config
            m_pPath->ClearHighlights();
            break;
        }
        node = node->GetNext();
    }


    m_pEnroutePoint = NULL;
    m_bStartNow = false;

    if( g_pPathManagerDialog && g_pPathManagerDialog->IsShown() ) {
        g_pPathManagerDialog->UpdatePathListCtrl();
    }

    Hide();
    RequestRefresh( GetOCPNCanvasWindow() );
    
    event.Skip();

}
void OptionsDlg::OnButtonOK(wxCommandEvent &event)
{
	wxUnusedVar(event);
	SaveChanges();
	ManagerST::Get()->ApplySettingsChanges();
	// and close the dialog
	EndModal(wxID_OK);
}
Ejemplo n.º 5
0
void SyntaxHighlightDlg::OnButtonOK( wxCommandEvent& event )
{
    wxUnusedVar(event);
    SaveChanges();
    clMainFrame::Get()->GetMainBook()->ApplySettingsChanges();
    // and close the dialog
    EndModal(wxID_OK);
}
Ejemplo n.º 6
0
void dialogEditor_dataitem::OnAddNew()
{
	SaveChanges();

	LPSTRUCT_LIVEBITITEM lpDataItem = NULL;
	if((lpDataItem = new STRUCT_LIVEBITITEM) == NULL)
		return;
}
Ejemplo n.º 7
0
void SyntaxHighlightDlg::OnButtonApply( wxCommandEvent& event )
{
    SaveChanges();
    clMainFrame::Get()->GetMainBook()->ApplySettingsChanges();

    m_startingTheme = m_themes->GetStringSelection().IsEmpty() ? wxT("Default") : m_themes->GetStringSelection();
    wxUnusedVar(event);
}
Ejemplo n.º 8
0
long EditorWindow::onClose(FXObject* pFXO, FXSelector FXS, void* pv)
{
    // vuoi salvare prima??
    bool Continue = SaveChanges();

    if (Continue)
    {
        getApp()->exit();
    }
    return 1;
}
Ejemplo n.º 9
0
void ODPropertiesDialogImpl::OnDrawPropertiesOKClick( wxCommandEvent& event )
{
    SaveChanges(); // write changes to globals and update config
    Show( false );
#ifdef __WXOSX__    
    EndModal(wxID_OK);
#endif
    SetClientSize(m_defaultClientSize);

    ResetGlobalLocale();
    event.Skip();
}
Ejemplo n.º 10
0
void SyntaxHighlightDlg::OnLexerSelected(wxCommandEvent& event)
{
    wxString lexerName = m_listBox->GetStringSelection();
    if(lexerName == CXX_AND_JAVASCRIPT) {
        lexerName = "c++";
    }
    
    if(m_isModified) {
        SaveChanges();
    }
    m_isModified = false;
    m_lexer = ColoursAndFontsManager::Get().GetLexer(lexerName);
    LoadLexer("");
}
Ejemplo n.º 11
0
long EditorWindow::onNewProject (FXObject* pFXO, FXSelector FXS, void* pv)
{
    // vuoi salvare prima??
    bool Continue = SaveChanges();

    if (Continue)
    {
        View[0]->makeCurrent();
        PM->ResetWorkspace();
        View[0]->makeNonCurrent();

        redrawAllViewports();
    }
    return 1;
}
Ejemplo n.º 12
0
void EventDlg::OnBnClickedCancel()
{
	int cont = IDYES;
	if (m_WaitingForFit)
		cont = AfxMessageBox("Cancel this dialog and discard the selected measurement events?\r\nSelect Yes to discard the events and close.\r\nSelect No to go back to the events dialog.",
		MB_YESNO);

	if (m_WaitingForPersist)
	{
		SaveChanges();
	}


	if (cont == IDYES)
	{
		OnCancel();
	}
}
Ejemplo n.º 13
0
void __fastcall TfrmBillConfig::FormClose(TObject *Sender,
      TCloseAction &Action)
{
  if(BillConfig->IsModified())
  {
    switch(MessageBox(Handle,"是否要保存所做的更改?","问题",MB_YESNOCANCEL | MB_ICONQUESTION))
    {
    case IDYES:
      if(!SaveChanges(false))
        throw new Exception("");
      break;
    case IDCANCEL:
      throw new Exception("");
    default:
      break;
    }
  }
}
Ejemplo n.º 14
0
void dialogEditor_dataitem::OnNext()
{
	CString sError;

	if(listDataItem.GetCount() == 0) return;

	SaveChanges();
	iIndex++;
	if(iIndex >= listDataItem.GetCount())
	{
		iIndex = listDataItem.GetCount();
		pos = listDataItem.GetTailPosition();
	}
	else
		listDataItem.GetNext(pos);
	GetData();
	UpdateLabels(FALSE);

	sError.Format("Editor - Data Item Data File (%i of %i)",iIndex,listDataItem.GetCount());
	SetWindowText(sError);
}
Ejemplo n.º 15
0
long EditorWindow::onLoad(FXObject*, FXSelector, void*)
{
    bool Continue = SaveChanges();

    if (Continue)
    {
        FXString FileName;
        FXFileDialog OpenDialog(this,"Apri Progetto");
        OpenDialog.setSelectMode(SELECTFILE_EXISTING);
        OpenDialog.setPatternList("Bezier Patch Project (*.bzp)");
        //OpenDialog.setCurrentPattern();
        OpenDialog.setFilename("");

        if(OpenDialog.execute())
        {
            FileName = OpenDialog.getFilename();
            View[0]->makeCurrent();
            PM->Load(FileName.text());
            View[0]->makeNonCurrent();
            redrawAllViewports();
        }
    }
    return 1;
}
Ejemplo n.º 16
0
StateId KPstateAudioSettings::ESCKeyAction(KPstateContext *pContext) const
{
    SaveChanges(pContext);
    return pContext->GetPreviousState();
}
void OptionsDlg::OnButtonApply(wxCommandEvent &event)
{
	SaveChanges();
	ManagerST::Get()->ApplySettingsChanges();
	wxUnusedVar(event);
}
Ejemplo n.º 18
0
void CTaggingPP::OnOK()
{
	SaveChanges();
	CPropertyPage::OnOK();
}
Ejemplo n.º 19
0
void __fastcall TfrmBillConfig::btnSaveClick(TObject *Sender)
{
  if(!BillConfig->IsModified())
    return;
  SaveChanges(true);  
}
Ejemplo n.º 20
0
bool CaptureContext::SaveCaptureTo(const rdcstr &captureFile)
{
  bool success = false;
  QString error;

  if(IsCaptureLocal())
  {
    if(QFileInfo(GetCaptureFilename()).exists())
    {
      if(GetCaptureFilename() == captureFile)
      {
        success = true;
      }
      else
      {
        ICaptureFile *capFile = Replay().GetCaptureFile();

        if(capFile)
        {
          // this will overwrite
          success = capFile->CopyFileTo(captureFile.c_str());
        }
        else
        {
          // QFile::copy won't overwrite, so remove the destination first (the save dialog already
          // prompted for overwrite)
          QFile::remove(captureFile);
          success = QFile::copy(GetCaptureFilename(), captureFile);
        }

        error = tr("Couldn't save to %1").arg(captureFile);
      }
    }
    else
    {
      RDDialog::critical(
          NULL, tr("File not found"),
          error =
              tr("Capture '%1' couldn't be found on disk, cannot save.").arg(GetCaptureFilename()));
      success = false;
    }
  }
  else
  {
    Replay().CopyCaptureFromRemote(GetCaptureFilename(), captureFile, m_MainWindow);
    success = QFile::exists(captureFile);

    error = tr("File couldn't be transferred from remote host");
  }

  if(!success)
  {
    RDDialog::critical(NULL, tr("Error Saving"), error);
    return false;
  }

  // if it was a temporary capture, remove the old instnace
  if(m_CaptureTemporary)
    QFile::remove(m_CaptureFile);

  // Update the filename, and mark that it's local and not temporary now.
  m_CaptureFile = captureFile;
  m_CaptureLocal = true;
  m_CaptureTemporary = false;

  Replay().ReopenCaptureFile(captureFile);
  SaveChanges();

  return true;
}
Ejemplo n.º 21
0
void CaptureContext::RecompressCapture()
{
  QString destFilename = GetCaptureFilename();
  QString tempFilename;

  ICaptureFile *cap = NULL;
  ICaptureFile *tempCap = NULL;

  bool inplace = false;

  if(IsCaptureTemporary() || !IsCaptureLocal())
  {
    QMessageBox::StandardButton res =
        RDDialog::question(m_MainWindow, tr("Unsaved capture"),
                           tr("To recompress a capture you must save it first. Save this capture?"),
                           QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);

    if(res == QMessageBox::Cancel || res == QMessageBox::No)
      return;

    destFilename = m_MainWindow->GetSavePath();

    // if it's already local, we'll do the save as part of the recompression convert. If it's
    // remote, we need to copy it first, but we copy it to a temporary so we can do the conversion
    // to the target location

    if(IsCaptureLocal())
    {
      tempFilename = GetCaptureFilename();
    }
    else
    {
      tempFilename = TempCaptureFilename(lit("recompress"));
      Replay().CopyCaptureFromRemote(GetCaptureFilename(), tempFilename, m_MainWindow);

      if(!QFile::exists(tempFilename))
      {
        RDDialog::critical(m_MainWindow, tr("Failed to save capture"),
                           tr("Capture couldn't be saved from remote."));
        return;
      }
    }
  }
  else
  {
    // if we're doing this inplace on an already saved capture, then we need to recompress to a
    // temporary and close/move it afterwards.
    inplace = true;
    destFilename = TempCaptureFilename(lit("recompress"));
  }

  if(IsCaptureLocal())
  {
    // for local files we already have a handle. We'll reuse it, then re-open
    cap = Replay().GetCaptureFile();
  }
  else
  {
    // for remote files we open a new short-lived handle on the temporary file
    tempCap = cap = RENDERDOC_OpenCaptureFile();
    cap->OpenFile(tempFilename.toUtf8().data(), "rdc");
  }

  if(!cap)
  {
    RDDialog::critical(m_MainWindow, tr("Unexpected missing handle"),
                       tr("Couldn't get open handle to file for recompression."));
    return;
  }

  int index = cap->FindSectionByType(SectionType::FrameCapture);
  SectionProperties props = cap->GetSectionProperties(index);

  if(props.flags & SectionFlags::ZstdCompressed)
  {
    RDDialog::information(m_MainWindow, tr("Capture already compressed"),
                          tr("This capture is already compressed as much as is possible."));

    if(tempCap)
      tempCap->Shutdown();
    if(!tempFilename.isEmpty())
      QFile::remove(tempFilename);
    return;
  }

  // convert from the currently open cap to the destination
  float progress = 0.0f;

  LambdaThread *th = new LambdaThread([this, cap, destFilename, &progress]() {
    cap->Convert(destFilename.toUtf8().data(), "rdc", [&progress](float p) { progress = p; });
  });
  th->start();
  // wait a few ms before popping up a progress bar
  th->wait(500);
  if(th->isRunning())
  {
    ShowProgressDialog(m_MainWindow, tr("Recompressing file."), [th]() { return !th->isRunning(); },
                       [&progress]() { return progress; });
  }
  th->deleteLater();

  if(inplace)
  {
    // if we're recompressing "in place", we need to close our capture, move the temporary over
    // the original, then re-open.

    // this releases the hold over the real desired location.
    cap->OpenFile("", "");

    // now remove the old capture
    QFile::remove(GetCaptureFilename());

    // move the recompressed one over
    QFile::rename(destFilename, GetCaptureFilename());

    // and re-open
    cap->OpenFile(GetCaptureFilename().c_str(), "rdc");
  }
  else
  {
    // we've converted into the desired location. We don't have to do anything else but mark our
    // new locally saved non-temporary status.

    m_CaptureFile = destFilename;
    m_CaptureLocal = true;
    m_CaptureTemporary = false;

    // open the saved capture file. This will let us remove the old file too
    Replay().ReopenCaptureFile(m_CaptureFile);

    m_CaptureMods = CaptureModifications::All;

    SaveChanges();
  }

  // close any temporary resources
  if(tempCap)
    tempCap->Shutdown();
  if(!tempFilename.isEmpty())
    QFile::remove(tempFilename);
}
Ejemplo n.º 22
0
OleProperties::~OleProperties()
{
	SaveChanges();
}
void        Command( HWND hwnd, ULONG ulCmd)

{
    switch (ulCmd)
    {
        case IDM_DELETE:
            ToggleDelete();
        break;

        case IDM_DELETEALL:
            SetDelete( TRUE);
        break;

        case IDM_UNDELETEALL:
            SetDelete( FALSE);
        break;

        case IDM_OPEN:
            OpenObject( hwnd);
        break;

        case IDM_LOCATE:
            LocateObject( hwnd);
        break;

        case IDM_MENU:
            ShowObjMenu( hwnd);
        break;

        case IDM_SORTDEL:
        case IDM_SORTNBR:
        case IDM_SORTVIEW:
        case IDM_SORTTITLE:
        case IDM_SORTSIZE:
        case IDM_SORTKEY:
        case IDM_SORTPATH:
            SetSortColumn( ulCmd - IDM_SORTFIRST);
            break;

        case IDM_SORTDONE:
            break;

        case IDM_GETDATA:
            if (SaveChanges( "Reload", TRUE))
                GetData();
            break;

        case IDM_RESETCOL:
            ResetColumnWidths();
            break;

        case IDM_SAVE:
            SaveChanges( "Save now", FALSE);
            break;

        case IDM_OPTDLG:
            WinDlgBox( HWND_DESKTOP,       // parent-window
                       hwnd,               // owner-window
                       OptionsDlgProc,     // dialog proc
                       NULLHANDLE,         // EXE module handle
                       IDD_OPTIONS,        // dialog id
                       NULL);              // pointer to create params
            break;
    }

    return;
}
HoIModDesigner::HoIModDesigner(QWidget *parent)
	: QMainWindow(parent),
	m_DockWidgetNationList(nullptr),
	m_DockWidgetNationDetails(nullptr),
	m_Parser(nullptr)
{
	ui.setupUi(this);

	QIcon recycle(":HoIModDesigner/images/exit.ico");
	QList<QSize> sizes = recycle.availableSizes();

	m_ExitAction = new QAction(recycle,tr("E&xit"), this);
	m_ExitAction->setShortcuts(QKeySequence::Quit);
	m_ExitAction->setStatusTip(tr("Quit Scenediagram example"));
	connect(m_ExitAction, SIGNAL(triggered()), this, SLOT(close()));

	m_LoadMapAction = new QAction(QIcon(":HoIModDesigner/images/folder_document.ico"),tr("Load"),this );
	m_LoadMapAction->setStatusTip(tr("Load HoI3 map"));
	connect(m_LoadMapAction, SIGNAL(triggered()), this, SLOT(LoadMap()));

	m_SaveChangesAction = new QAction(QIcon(":HoIModDesigner/images/floppy_disk.ico"),tr("Save"),this );
	m_SaveChangesAction->setStatusTip(tr("Save changes"));
	connect(m_SaveChangesAction, SIGNAL(triggered()), this, SLOT(SaveChanges()));

	m_FileConfigurationAction = new QAction(QIcon(":HoIModDesigner/images/gear.ico"),tr("Configuration..."),this );
	m_FileConfigurationAction->setStatusTip(tr("Open configuration dialog"));
	connect(m_FileConfigurationAction, SIGNAL(triggered()), this, SLOT(OpenConfigurationDialog()));

	m_AboutAction = new QAction(QIcon(":HoIModDesigner/images/about.ico"),tr("About..."),this );
	m_AboutAction->setStatusTip(tr("Show about dialog"));
//	connect(m_AboutAction, SIGNAL(triggered()), this, SLOT(About()));

	m_FileMenu = menuBar()->addMenu(tr("&File"));
	m_FileMenu->addAction( m_LoadMapAction );
	m_FileMenu->addAction( m_SaveChangesAction );
	m_FileMenu->addSeparator();
	m_FileMenu->addAction( m_FileConfigurationAction );
	m_FileMenu->addSeparator();
	m_FileMenu->addAction( m_ExitAction );

	m_DockWidgetsMenu = menuBar()->addMenu("Windows");

	m_HilfeMenu = menuBar()->addMenu(tr("Help"));
	m_HilfeMenu->addAction( m_AboutAction );

	m_FileToolBar = addToolBar(tr("Edit"));
	m_FileToolBar->addAction(m_ExitAction);
	m_FileToolBar->addAction(m_LoadMapAction);
	m_FileToolBar->addAction(m_SaveChangesAction);

	m_ShowOriginalMap = new QAction(QIcon("images/test.png"),tr("Original"), this);
	m_ShowOriginalMap->setStatusTip(tr("Shows original map"));
	connect(m_ShowOriginalMap, SIGNAL(triggered()), this, SLOT(ShowOriginalMap()));

	m_ShowNationColorMap = new QAction(QIcon(":HoIModDesigner/images/mapmode_political.ico"),tr("Nations"), this);
	m_ShowNationColorMap->setStatusTip(tr("Shows map by country colors"));
	connect(m_ShowNationColorMap, SIGNAL(triggered()), this, SLOT(ShowNationColorMap()));

	m_ShowMetalProvinces = new FilterAction(QIcon(":HoIModDesigner/images/resource_metal.ico"),tr("Metal"), new TimeLineDataCriteriaMetal(), this);
	m_ShowMetalProvinces->setStatusTip(tr("Shows only provinces with metal"));

	m_ShowOilProvinces = new FilterAction(QIcon(":HoIModDesigner/images/resource_oil.ico"),tr("Crude oil"), new TimeLineDataCriteriaCrudeOil(), this);
	m_ShowOilProvinces->setStatusTip(tr("Shows only provinces with crude oil"));

	m_ShowEnergyProvinces = new FilterAction(QIcon(":HoIModDesigner/images/resource_energy.ico"),tr("Energy"), new TimeLineDataCriteriaEnergy(), this);
	m_ShowEnergyProvinces->setStatusTip(tr("Shows only provinces with energy"));

	m_ShowRareProvinces = new FilterAction(QIcon(":HoIModDesigner/images/resource_raremat.ico"),tr("Rare material"), new TimeLineDataCriteriaRareMaterial(), this);
	m_ShowRareProvinces->setStatusTip(tr("Shows only provinces with rare material"));

	m_ShowIndustryProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_factory.ico"),tr("Industry"), new TimeLineDataCriteriaIndustry(), this);
	m_ShowIndustryProvinces->setStatusTip(tr("Shows only provinces with industry"));

	m_ShowAAProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_aa.ico"),tr("Antiair"), new TimeLineDataCriteriaAntiair(), this);
	m_ShowAAProvinces->setStatusTip(tr("Shows only provinces with antiair"));

	m_ShowAirbaseProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_airbase.ico"),tr("Airbase"), new TimeLineDataCriteriaAirbase(), this);
	m_ShowAirbaseProvinces->setStatusTip(tr("Shows only provinces with airbase"));

	m_ShowCoastalfortProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_coastalfort.ico"),tr("Coastalfort"), new TimeLineDataCriteriaCoastalfort(), this);
	m_ShowCoastalfortProvinces->setStatusTip(tr("Shows only provinces with coastalfort"));

	m_ShowInfraProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_infra.ico"),tr("Infrastructure"), new TimeLineDataCriteriaInfrastructure(), this);
	m_ShowInfraProvinces->setStatusTip(tr("Shows only provinces with infrastructure"));

	m_ShowLandfortProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_landfort.ico"),tr("Landfort"), new TimeLineDataCriteriaLandfort(), this);
	m_ShowLandfortProvinces->setStatusTip(tr("Shows only provinces with landfort"));

	m_ShowNavalbaseProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_navalbase.ico"),tr("Navalbase"), new TimeLineDataCriteriaNavalbase(), this);
	m_ShowNavalbaseProvinces->setStatusTip(tr("Shows only provinces with navalbase"));

	m_ShowNuclearProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_nuclear.ico"),tr("Nuclear"), new TimeLineDataCriteriaNuclear(), this);
	m_ShowNuclearProvinces->setStatusTip(tr("Shows only provinces with nuclear"));

	m_ShowRadarProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_radar.ico"),tr("Radar"), new TimeLineDataCriteriaRadar(), this);
	m_ShowRadarProvinces->setStatusTip(tr("Shows only provinces with radar"));

	m_ShowRocketProvinces  = new FilterAction(QIcon(":HoIModDesigner/images/icon_build_rocket.ico"),tr("Rocket"), new TimeLineDataCriteriaRocket(), this);
	m_ShowRocketProvinces->setStatusTip(tr("Shows only provinces with rocket"));

	m_MapFilterToolBar = addToolBar(tr("Map filter"));
	m_MapFilterToolBar->addAction(m_ShowOriginalMap);
	m_MapFilterToolBar->addAction(m_ShowNationColorMap);
	m_MapFilterToolBar->addAction(m_ShowEnergyProvinces);
	m_MapFilterToolBar->addAction(m_ShowMetalProvinces);
	m_MapFilterToolBar->addAction(m_ShowRareProvinces);
	m_MapFilterToolBar->addAction(m_ShowOilProvinces);
	m_MapFilterToolBar->addAction(m_ShowIndustryProvinces);
	m_MapFilterToolBar->addAction(m_ShowAAProvinces);
	m_MapFilterToolBar->addAction(m_ShowAirbaseProvinces);
	m_MapFilterToolBar->addAction(m_ShowCoastalfortProvinces);
	m_MapFilterToolBar->addAction(m_ShowInfraProvinces);
	m_MapFilterToolBar->addAction(m_ShowLandfortProvinces);
	m_MapFilterToolBar->addAction(m_ShowNavalbaseProvinces);
	m_MapFilterToolBar->addAction(m_ShowNuclearProvinces);
	m_MapFilterToolBar->addAction(m_ShowRadarProvinces);
	m_MapFilterToolBar->addAction(m_ShowRocketProvinces);

	QToolButton *button2 = new QToolButton;
	button2->setText("Testicon2");
	button2->setIcon(QIcon(":HoIModDesigner/images/add2.ico"));
	button2->setIconSize(QSize(48, 48));
	button2->setCheckable(true);
	connect(button2,SIGNAL(clicked()),this,SLOT(DisplayContourMap()));
	
	QToolButton *button5 = new QToolButton;
	button5->setText("Testicon3");
	button5->setIcon(QIcon(":HoIModDesigner/images/add2.ico"));
	button5->setIconSize(QSize(48, 48));
	button5->setCheckable(true);

	QGridLayout *layout = new QGridLayout;
	layout->addWidget(button2, 0, 0, Qt::AlignHCenter);
	layout->addWidget(button5, 1, 0, Qt::AlignHCenter);

	QWidget *widget = new QWidget;
	widget->setLayout(layout);

	QGridLayout *backgroundLayout = new QGridLayout;
	backgroundLayout->addWidget(widget, 0, 0);

	QButtonGroup *paintEvents = new QButtonGroup(this);
	paintEvents->setExclusive(true);
	QVBoxLayout *layoutPaintEvents = new QVBoxLayout;
	int buttonID = 0;
	m_PainterWidgets.append(CreatePaintButton( tr("Owner"), "D:/Spiele/HoI3/gfx/interface/mapmode_political.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Energy"), "D:/Spiele/HoI3/tfh/gfx/mapitems/resource_energy.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Metal"), "D:/Spiele/HoI3/tfh/gfx/mapitems/resource_metal.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Rare materials"), "D:/Spiele/HoI3/tfh/gfx/mapitems/resource_raremat.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Crude oil"), "D:/Spiele/HoI3/tfh/gfx/mapitems/resource_oil.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Industry"), "D:/Spiele/HoI3/gfx/interface/prov_build_factory.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Infrastructure"), "D:/Spiele/HoI3/gfx/interface/prov_build_infra.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Anti air"), "D:/Spiele/HoI3/gfx/interface/prov_build_aa.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Airfield"), "D:/Spiele/HoI3/gfx/interface/prov_build_airfield.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Landfort"), "D:/Spiele/HoI3/gfx/interface/prov_build_landfort.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Coastfort"), "D:/Spiele/HoI3/gfx/interface/prov_build_coastfort.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Naval base"), "D:/Spiele/HoI3/gfx/interface/prov_build_navalbase.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Nuclear"), "D:/Spiele/HoI3/gfx/interface/prov_build_nuclear.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Radar"), "D:/Spiele/HoI3/gfx/interface/prov_build_radar.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Rocket"), "D:/Spiele/HoI3/gfx/interface/prov_build_rocket.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Leadership"), "D:/Spiele/HoI3/gfx/interface/icon_leadership.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Manpower"), "D:/Spiele/HoI3/gfx/interface/icon_manpower.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Points"), "D:/Spiele/HoI3/gfx/interface/mapmode_vp.dds", paintEvents, buttonID++ ));
	m_PainterWidgets.append(CreatePaintButton( tr("Controller"), "D:/Spiele/HoI3/gfx/interface/mapmode_political.dds", paintEvents, buttonID++ ));
	for( int i=0; i < m_PainterWidgets.size();i++ )
	{
		layoutPaintEvents->addWidget( m_PainterWidgets.at(i) );
	}

	connect(paintEvents,SIGNAL(buttonClicked(int)),this,SLOT(SetFactoryForExtendedScene(int)));
	
	QWidget *itemWidget = new QWidget;
	itemWidget->setLayout(layoutPaintEvents);

	m_ToolBox = new QToolBox;
	m_ToolBox->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Ignored));
	m_ToolBox->setMinimumWidth(itemWidget->sizeHint().width());
	m_ToolBox->addItem(widget, tr("Test group"));
	m_ToolBox->addItem(itemWidget, tr("Painters"));

	QHBoxLayout *layoutMain = new QHBoxLayout;
	layoutMain->addWidget(m_ToolBox);
	m_View = new ExtendedGraphicsView(this);
	m_View->setMouseTracking(true);
	m_View->setInteractive(true);
	m_View->setOptimizationFlags(QGraphicsView::DontClipPainter);
	m_View->setOptimizationFlags(QGraphicsView::DontSavePainterState);
	m_View->setOptimizationFlags(QGraphicsView::DontAdjustForAntialiasing);
	m_View->setCacheMode(QGraphicsView::CacheBackground);
	layoutMain->addWidget(m_View);

	QWidget *widgetMain = new QWidget;
	widgetMain->setLayout(layoutMain);

	CreateDockWidgets();

	setCentralWidget(widgetMain);
	setWindowState(windowState() | Qt::WindowMaximized);

	connect(m_View->m_Scene, SIGNAL(SignalProvinceEntered(ProvinceItem*)),m_View->m_Scene, SLOT(SlotProvinceEntered(ProvinceItem*)));
	connect(m_View->m_Scene, SIGNAL(SignalProvinceMouseReleased(ProvinceItem*)),this, SLOT(SlotProvinceMouseReleased(ProvinceItem*)));

	jha::LogInterface().Init();
	jha::GetLog()->RegisterLogger( new jha::LoggerFile("d:/temp/Logfile.log") );
	jha::GetLog()->RegisterLogger( new jha::LoggerTableWidget(m_DockWidgetLogging) );
	jha::GetLog()->Start();
}
Ejemplo n.º 25
0
void dialogEditor_dataitem::OnSave()
{
	int fhOutput = -1;
	CString sError;
	int iLoop = 0;
	int iSub = 0;
	unsigned char cTemp;
	LPSTRUCT_LIVEBITITEM lpDataItem = NULL;
	unsigned long* lpOffset = NULL;
	POSITION pos = NULL;

	SaveChanges();
	BrowseForFile(&sError,"Select a filename for the Data Item Data File",OFN_OVERWRITEPROMPT);
	if((fhOutput = _open(sError,_O_BINARY | _O_CREAT | _O_WRONLY,_S_IWRITE)) == -1)
		return;
	if((_chsize(fhOutput,0)) == -1)
		return;

	// Live Data File Format
	// 1 bytes [Version Length]
	// x bytes [Version]
	// 1 bytes [Version Checksum]
	// [..]
	//		1 bytes [Byte]
	//		1 bytes [Bit]
	//		1 bytes [Name Length]
	//		x bytes [Name]
	//		4 bytes [Address High]
	//		4 bytes [Address Low]
	//		1 bytes [Type]
	//		2 bytes [Operand Addition]
	//		2 bytes [Operand Subtract]
	//		2 bytes [Operand Multiplier]
	//		2 bytes [Operand Divisor]
	//		2 bytes [Decimals]
	//		1 bytes [Unit Length]
	//		x bytes [Unit]
	//		2 bytes [Description Length]
	//		x bytes [Description]
	//		1 bytes [Checksum]
	// [..]

	cTemp = (char)sVersion.GetLength();
	_write(fhOutput,&cTemp,1);
	_write(fhOutput,(LPCTSTR)sVersion,cTemp);
	cTemp += GenerateChecksum(sVersion,sVersion.GetLength());
	_write(fhOutput,&cTemp,1);

	pos = listDataItem.GetHeadPosition();
	while(pos != NULL)
	{
		lpDataItem = (LPSTRUCT_LIVEBITITEM)listDataItem.GetNext(pos);
		_write(fhOutput,&lpDataItem->cByte,1);
		_write(fhOutput,&lpDataItem->cBit,1);
		_write(fhOutput,&lpDataItem->cLength_name,1);
		_write(fhOutput,lpDataItem->szName,lpDataItem->cLength_name);
		_write(fhOutput,&lpDataItem->ulAddress_high,4);
		_write(fhOutput,&lpDataItem->ulAddress_low,4);
		_write(fhOutput,&lpDataItem->cType,1);
		_write(fhOutput,&lpDataItem->usOperand_addition,2);
		_write(fhOutput,&lpDataItem->usOperand_subtract,2);
		_write(fhOutput,&lpDataItem->usOperand_multiplier,2);
		_write(fhOutput,&lpDataItem->usOperand_divisor,2);
		_write(fhOutput,&lpDataItem->usDecimals,2);
		_write(fhOutput,&lpDataItem->cLength_unit,1);
		_write(fhOutput,lpDataItem->szUnit,lpDataItem->cLength_unit);
		_write(fhOutput,&lpDataItem->usLength_description,2);
		_write(fhOutput,lpDataItem->szDescription,lpDataItem->usLength_description);

		cTemp = GenerateChecksum(lpDataItem);
		_write(fhOutput,&cTemp,1);
	}
}
Ejemplo n.º 26
0
void ODPropertiesDialogImpl::OnDrawPropertiesApplyClick( wxCommandEvent& event )
{
    SaveChanges(); // write changes to globals and update config

    event.Skip();
}
Ejemplo n.º 27
0
void SyntaxHighlightDlg::OnButtonApply(wxCommandEvent& event)
{
    SaveChanges();
    clMainFrame::Get()->GetMainBook()->ApplySettingsChanges();
    wxUnusedVar(event);
}