Ejemplo n.º 1
0
void Scene_Order::UpdateConfirm() {
	if (Input::IsTriggered(Input::CANCEL)) {
		Redo();
	} else if (Input::IsTriggered(Input::DECISION)) {
		if (window_confirm->GetIndex() == 0) {
			Confirm();
			Scene::Pop();
		} else {
			Redo();
		}
	}
}
Ejemplo n.º 2
0
bool mitk::LimitedLinearUndo::Redo()
{
  if (m_RedoList.empty()) return false;

  int redoObjectEventId = m_RedoList.back()->GetObjectEventId();
  return Redo( redoObjectEventId );
}
void ImageGroundTruthPanelViewer::on_key_down(wxKeyEvent & event)
{
    if(event.ControlDown() && event.GetUnicodeKey() == 'O')
    {
        InitIO();
        return;
    }

    if(mp_ground_truth_manager->IsEmpty())
    {
        return ;
    }

    try
    {
        switch(event.GetKeyCode())
        {
            case WXK_PAGEUP: LoadNextImage(); break;
            case WXK_PAGEDOWN: LoadPreviousImage(); break;
        }
        if(event.ControlDown())
        {
            switch(event.GetUnicodeKey())
            {
                case 'S': Save(); break;
                case 'Z': Undo(); break;
                case 'Y': Redo(); break;
                case 'A': MarkAsBlind(); break;
                case 'I': MarkAsUnknown(); break;
                case 'R': Reject(); break;
            }
        }
    }
    JPB_wx_CATCH("échec de l'ajout d'une boîtes englobante d'occlusion");
}
void
MainWindow::InitEditMenu()
///
/// Initializes the edit menu and it's associated actions
///
/// @return
///  Nothing
///
{
	mUndoAction = new QAction( tr("&Undo"), this);
	mRedoAction = new QAction( tr("&Redo"), this);

	mEditMenu = menuBar()->addMenu( tr("&Edit") );
	mEditMenu->addAction( mUndoAction );
	mEditMenu->addAction( mRedoAction );

	// Connect the menu actions to their respective slots
	connect( mUndoAction, SIGNAL( triggered() ), this, SLOT( Undo() ) );
	connect( mRedoAction, SIGNAL( triggered() ), this, SLOT( Redo() ) );

	// Disable the actions until the main window broadcasts for them to be active
	mUndoAction->setDisabled( true );
	mRedoAction->setDisabled( true );

	connect( this, SIGNAL( UndoIsActive(bool) ), mUndoAction, SLOT( setEnabled(bool) ) );
	connect( this, SIGNAL( RedoIsActive(bool) ), mRedoAction, SLOT( setEnabled(bool) ) );
}
Ejemplo n.º 5
0
void MainWindow::CreateProjectNew(bool newProjectFile)
{
	if (newProject)
		delete newProject;

	if (newProjectFile)
	{
		newProject = new Project_new(this);
	} else {
		QStringList selections;
		QFileDialog dialog(0, "Open an ADCIRC Subdomain Project", QDir::homePath());
		dialog.setModal(true);
		dialog.setNameFilter("ADCIRC Subdomain Projects (*.spf)");
		dialog.setFileMode(QFileDialog::ExistingFile);
		if (dialog.exec())
		{
			selections = dialog.selectedFiles();
			if (!selections.isEmpty())
			{
				newProject = new Project_new(selections.first(), this);
			}
		} else {
			return;
		}
	}

	newProject->SetOpenGLPanel(ui->GLPanel);
	newProject->SetProgressBar(ui->progressBar);
	newProject->SetProjectTree(ui->projectTree);

	/* Subdomain Creation */
	connect(ui->createSubdomainButton, SIGNAL(clicked()), newProject, SLOT(CreateNewSubdomain()));

	/* Selection Tools */
	connect(ui->selectNodesCircle, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainCircleElements()));
	connect(ui->selectElementSingle, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainClickElements()));
	connect(ui->selectNodeSingle, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainPolygonElements()));
	connect(ui->selectNodesSquare, SIGNAL(clicked()), newProject, SLOT(SelectFullDomainRectangleElements()));

	connect(ui->undoButton, SIGNAL(clicked()), newProject, SLOT(Undo()));
	connect(ui->redoButton, SIGNAL(clicked()), newProject, SLOT(Redo()));

	/* U/I Updates */
	connect(newProject, SIGNAL(mouseX(float)), this, SLOT(showMouseX(float)));
	connect(newProject, SIGNAL(mouseY(float)), this, SLOT(showMouseY(float)));
	connect(newProject, SIGNAL(undoAvailable(bool)), ui->undoButton, SLOT(setEnabled(bool)));
	connect(newProject, SIGNAL(redoAvailable(bool)), ui->redoButton, SLOT(setEnabled(bool)));
	connect(newProject, SIGNAL(numElements(int)), this, SLOT(showNumElements(int)));
	connect(newProject, SIGNAL(numNodes(int)), this, SLOT(showNumNodes(int)));
	connect(newProject, SIGNAL(numElementsSelected(int)), this, SLOT(showNumSelectedElements(int)));
	connect(newProject, SIGNAL(numNodesSelected(int)), this, SLOT(showNumSelectedNodes(int)));
	connect(newProject, SIGNAL(maxSelectedZ(float)), this, SLOT(showMaxSelectedZ(float)));
	connect(newProject, SIGNAL(minSelectedZ(float)), this, SLOT(showMinSelectedZ(float)));
	connect(newProject, SIGNAL(showProjectView()), this, SLOT(showProjectExplorerPane()));

	/* Running ADCIRC */
	connect(ui->actionFull_Domain, SIGNAL(triggered()), newProject, SLOT(RunFullDomain()));
}
Ejemplo n.º 6
0
void CEditWnd::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	CTextWnd::OnSysKeyDown(nChar, nRepCnt, nFlags);
	bool isAlt = (GetKeyState(VK_MENU) & 0xF0) != 0;
	bool isShift = (GetKeyState(VK_SHIFT) & 0xF0) != 0;
	bool isCtrl = (GetKeyState(VK_CONTROL) & 0xF0) != 0;
	if (nChar == VK_BACK && isShift && isAlt)
		Redo();
	if ((nChar == VK_BACK && isAlt)) 
		Undo();
}
Ejemplo n.º 7
0
SInt32 CDXUndoStack::GoTo(SInt32 index, bool doUpdate)
{
	SInt32 result = -1;
	SInt32 amount = index - m_index;

	if (amount == 0)
		return m_index;

	for (UInt32 i = 0; i < abs(amount); i++) {
		result = amount < 0 ? Undo(doUpdate) : Redo(doUpdate);
	}
	
	return result;
}
Ejemplo n.º 8
0
bool DeleteMap::HandleAction(QString &action, uint64_t frame, uint64_t played)
{
    bool handled = true;
    if (action == ACTION_UP)
        UpdateSeekAmount(1);
    else if (action == ACTION_DOWN)
        UpdateSeekAmount(-1);
    else if (action == ACTION_CLEARMAP)
        Clear(tr("Clear Cuts"));
    else if (action == ACTION_INVERTMAP)
        ReverseAll();
    else if (action == "MOVEPREV")
        MoveRelative(frame, false);
    else if (action == "MOVENEXT")
        MoveRelative(frame, true);
    else if (action == "CUTTOBEGINNING")
    {
        Push(tr("Cut to Beginning"));
        AddMark(frame, MARK_CUT_END);
    }
    else if (action == "CUTTOEND")
    {
        Push(tr("Cut to End"));
        AddMark(frame, MARK_CUT_START);
        // If the recording is still in progress, add an explicit end
        // mark at the end.
        if (m_ctx->player && m_ctx->player->IsWatchingInprogress())
            AddMark(m_ctx->player->GetTotalFrameCount() - 1, MARK_CUT_END);
    }
    else if (action == "NEWCUT")
        NewCut(frame);
    else if (action == "DELETE")
        //: Delete the current cut or preserved region
        Delete(frame, tr("Delete"));
    else if (action == "UNDO")
        Undo();
    else if (action == "REDO")
        Redo();
    else
        handled = false;
    return handled;
}
Ejemplo n.º 9
0
void  Engine::input(sf::Event *event)
{
    bool a = sf::Keyboard::isKeyPressed(sf::Keyboard::A);
    bool b = sf::Keyboard::isKeyPressed(sf::Keyboard::S);
    if (a && !b) setMode(EDITOR_1);
    else if (!a && b) setMode(EDITOR_2);
    else
        setMode(DEFAULT);

    bool n1 = false;
    bool n2 = false;
    if (event->type == sf::Event::KeyReleased)
    {
        if (event->key.code == sf::Keyboard::Num1) n1 = true;
        if (event->key.code == sf::Keyboard::Num2) n2 = true;

        if (event->key.code == sf::Keyboard::Z) Undo();
        if (event->key.code == sf::Keyboard::Y) Redo();
        if (event->key.code == sf::Keyboard::Space) saveConfig();

        if (event->key.code == sf::Keyboard::Return) renderToFile();

        if (event->key.code == sf::Keyboard::P)  fullOrWindowScreen();
    }


    if (a && !b) setMode(EDITOR_1);
    else if (!a && b) setMode(EDITOR_2);
    else
        setMode(DEFAULT);

    if (n1 && !n2) setTool(LINE);
    else if (!n1 && n2) setTool(CIRCLE);


    if (mode == EDITOR_1)
        editor1->input(event, window);

    if (mode == EDITOR_2)
        editor2->input(event, window);
}
void CommandManager::DoCommand(Command* pCommand, std::string& feedback){
	if(pCommand->getType() == UNDO){
		Undo(feedback);
	} else if(pCommand->getType() == REDO){
		Redo();
	} else {
		// Clear redo list
		if(pCommand->getType() != DISPLAY){
			ClearRedoList();
		}
		// Execute the command and add it to undo list if succeeded
		if (pCommand->execute(_taskList,feedback)){
			if(undoable(pCommand)){
				AddUndo(pCommand);
			} else {
				delete pCommand;
				pCommand = NULL;
			}
		}
	}
}
Ejemplo n.º 11
0
void SceneStructureWindow::SetShownScene(const ScenePtr &newScene)
{
    if (!scene.expired() && newScene == scene.lock())
        return;

    ScenePtr previous = ShownScene();
    if (previous)
    {
        disconnect(previous.get());
        Clear();
    }

    scene = newScene;
    treeWidget->SetScene(newScene);

    if (newScene)
    {
        // Now that treeWidget has scene, it also has UndoManager.
        UndoManager *undoMgr = treeWidget->GetUndoManager();
        undoButton_->setMenu(undoMgr->UndoMenu());
        redoButton_->setMenu(undoMgr->RedoMenu());
        connect(undoMgr, SIGNAL(CanUndoChanged(bool)), this, SLOT(SetUndoEnabled(bool)), Qt::UniqueConnection);
        connect(undoMgr, SIGNAL(CanRedoChanged(bool)), this, SLOT(SetRedoEnabled(bool)), Qt::UniqueConnection);
        connect(undoButton_, SIGNAL(clicked()), undoMgr, SLOT(Undo()), Qt::UniqueConnection);
        connect(redoButton_, SIGNAL(clicked()), undoMgr, SLOT(Redo()), Qt::UniqueConnection);

        Scene* s = ShownScene().get();
        connect(s, SIGNAL(EntityAcked(Entity *, entity_id_t)), SLOT(AckEntity(Entity *, entity_id_t)));
        connect(s, SIGNAL(EntityCreated(Entity *, AttributeChange::Type)), SLOT(AddEntity(Entity *)));
        connect(s, SIGNAL(EntityTemporaryStateToggled(Entity *, AttributeChange::Type)), SLOT(UpdateEntityTemporaryState(Entity *)));
        connect(s, SIGNAL(EntityRemoved(Entity *, AttributeChange::Type)), SLOT(RemoveEntity(Entity *)));
        connect(s, SIGNAL(ComponentAdded(Entity *, IComponent *, AttributeChange::Type)), SLOT(AddComponent(Entity *, IComponent *)));
        connect(s, SIGNAL(ComponentRemoved(Entity *, IComponent *, AttributeChange::Type)), SLOT(RemoveComponent(Entity *, IComponent *)));
        connect(s, SIGNAL(SceneCleared(Scene*)), SLOT(Clear()));

        Populate();
    }
}
String DisplayDirector::FunctionCall(String function, String arg, StyleScriptable* target)
{
	if (function == "actionAllowed") {
		bool result = false;
		arg = target->Eval(arg).trim();
		if (arg == "Save()")
			result = IsDirty();
		else if (arg == "Undo()")
			result = (lastAction != sentinalAction);
		else if (arg == "Redo()")
			result = (lastAction->NextAction() != NULL);
		else if (arg == "Copy()" || arg == "Cut()")
			result = (selection && selection->CanCopy());
		else if (arg == "Paste()")
			result = (selection && selection->CanPaste() && !System::GetClipboardText().empty());
		else if (arg.startsWith("doc-source.")) {
			arg = arg.substr(11, arg.length() - 11);
			return docSource->FunctionCall("actionAllowed", arg, target);
			}
		return (result ? "true" : "");
		}
	else if (function == "Undo")
		Undo();
	else if (function == "Redo")
		Redo();
	else if (function == "Save")
		Save();
	else if (function == "Copy")
		CopyToClipboard();
	else if (function == "Paste")
		Paste();
	else
		return StyleScriptable::FunctionCall(function, arg, target);

	return String();
}
Ejemplo n.º 13
0
ECEditorWindow::ECEditorWindow(Framework* fw, QWidget *parent) :
    QWidget(parent),
    framework(fw),
    ecBrowser(0),
    hasFocus(true)
{
    /// @todo Create UI fully in code (very simple UI file).
    setupUi(this);
    installEventFilter(this);

    Scene *scene = fw->Scene()->MainCameraScene();
    assert(scene);
    undoManager_ = new UndoManager(scene->shared_from_this(), this);
    transformEditor = new TransformEditor(scene->shared_from_this(), undoManager_);

    undoButton->setDisabled(true);
    redoButton->setDisabled(true);

    undoButton->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/undo-icon.png"));
    redoButton->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/redo-icon.png"));

    undoButton->setMenu(undoManager_->UndoMenu());
    redoButton->setMenu(undoManager_->RedoMenu());

    entityWidget->hide();

    ecBrowser = new ECBrowser(framework, this, browserWidget);
    ecBrowser->setMinimumWidth(100);
    browserWidget->layout()->addWidget(ecBrowser);

    // signals from attribute browser to editor window.
    connect(ecBrowser, SIGNAL(ShowXmlEditorForComponent(const QString &)), SLOT(ShowXmlEditorForComponent(const QString &)));
    connect(ecBrowser, SIGNAL(CreateNewComponent()), SLOT(CreateComponent()));
    connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
        SLOT(HighlightEntities(const QString&, const QString&)));
    connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
        SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)), Qt::UniqueConnection);

    ECEditorModule *ecEditorModule = framework->Module<ECEditorModule>();
    ecBrowser->SetItemExpandMemory(ecEditorModule->ExpandMemory());

    entityList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    connect(entityList, SIGNAL(itemSelectionChanged()), this, SLOT(Refresh()));
    connect(entityList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ShowEntityContextMenu(const QPoint &)));

    connect(toggleEntitiesButton, SIGNAL(pressed()), this, SLOT(ToggleEntityList()));
    connect(expandOrCollapseButton, SIGNAL(clicked()), ecBrowser, SLOT(ExpandOrCollapseAll()));

    connect(scene, SIGNAL(EntityRemoved(Entity*, AttributeChange::Type)), SLOT(RemoveEntity(Entity*)), Qt::UniqueConnection);
    connect(scene, SIGNAL(ActionTriggered(Entity *, const QString &, const QStringList &, EntityAction::ExecTypeField)),
        SLOT(OnActionTriggered(Entity *, const QString &, const QStringList &)), Qt::UniqueConnection);

    connect(this, SIGNAL(FocusChanged(ECEditorWindow *)), ecEditorModule, SLOT(ECEditorFocusChanged(ECEditorWindow*)));
    connect(this, SIGNAL(EditEntityXml(const QList<EntityPtr> &)), ecEditorModule, SLOT(CreateXmlEditor(const QList<EntityPtr> &)));
    connect(this, SIGNAL(EditComponentXml(const QList<ComponentPtr> &)), ecEditorModule, SLOT(CreateXmlEditor(const QList<ComponentPtr> &)));
    //connect(this, SIGNAL(AttributeAboutToBeEdited(IAttribute *)), this, SLOT(OnAboutToEditAttribute(IAttribute* )));
    connect(undoManager_, SIGNAL(CanUndoChanged(bool)), this, SLOT(OnUndoChanged(bool)));
    connect(undoManager_, SIGNAL(CanRedoChanged(bool)), this, SLOT(OnRedoChanged(bool)));
    connect(undoButton, SIGNAL(clicked()), undoManager_, SLOT(Undo()));
    connect(redoButton, SIGNAL(clicked()), undoManager_, SLOT(Redo()));

    connect(framework->Input()->TopLevelInputContext(), SIGNAL(KeyPressed(KeyEvent*)), SLOT(OnKeyEvent(KeyEvent*)));

    // Make sure the editor is cleared if the scene is cleared or removed.
    connect(scene, SIGNAL(SceneCleared(Scene *)), SLOT(OnSceneRemoved(Scene *)));
    connect(framework->Scene(), SIGNAL(SceneAboutToBeRemoved(Scene *, AttributeChange::Type)), SLOT(OnSceneRemoved(Scene *)));
}
Ejemplo n.º 14
0
bool mitk::LimitedLinearUndo::Redo(bool)
{
  return Redo();
}
Ejemplo n.º 15
0
bool Game::PollEvents()
{
	SDL_Event event;
	
	/* Poll for events. SDL_PollEvent() returns 0 when there are no  */
	/* more events on the event queue, our while loop will exit when */
	/* that occurs.                                                  */
	while( SDL_PollEvent( &event ) )
	{
		/* We are only worried about SDL_KEYDOWN and SDL_KEYUP events */
		switch( event.type )
		{
			case SDL_KEYDOWN:
				switch (event.key.keysym.sym) 
				{
					case SDLK_ESCAPE:
						fprintf(stderr, "Hit Escape!n");
						m_bShouldQuit = true;
					return false;
					break;

					case SDLK_UP:
                                        case SDLK_8:
                                                Move(Up);
        	                                break;
                                        
                                        case SDLK_DOWN:
                                        case SDLK_2:
                                                Move(Down);
	                                        break;

					case SDLK_RIGHT:
					case SDLK_6:
						Move(Right);
						break;
					
					case SDLK_LEFT:
					case SDLK_4:
						Move(Left);
						break;

					case SDLK_PLUS:
						Redo();
						break;

					case SDLK_MINUS:
						Undo();
						break;

					default:
						break;
				}
				break;
			
			//Called when the mouse moves
			case SDL_MOUSEMOTION:
				break;
			
			case SDL_KEYUP:
				break;
			
			default:
				break;
		}
	}
	return true;
}
Ejemplo n.º 16
0
LRESULT CALLBACK HWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		//case WM_ACTIVE:
		//break;
		case WM_KEYDOWN:
		case WM_KEYUP:
			CallWindowProc((WNDPROC)GetWindowLong(hGLWnd, GWL_WNDPROC), hGLWnd, msg, wParam, lParam);
			return TRUE;//オリジナルのメッセージ処理を行わないとLayouterWindow.cppが機能しない
		case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{
				case ID_FILE_NEW_LAYOUT:
				{
					//long nUndoBuffer = GetUndoBufferNum();
					//if(dwLastSaveTime){
					//	if(MBQ("This document has been modified. Save?")){
					//		CallWindowProc((WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC), hWnd, WM_COMMAND, ID_FILE_SAVE_OW, 0);
					//	}
					//}
					FreeAll();
					RefreshAllView();
					break;
				}
				case ID_FILE_OPEN_LAYOUT:
				{
					char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024);
						if(GetOpenFileNameSingle(hGLWnd, "kdf", szFile, FALSE))
						{
							lstrcpy(g_szFileName, szFile);
							FreeAll();
							demo.Load(szFile);
							RefreshAllView();
						}
					GlobalFree(szFile);
					break;
				}
				case ID_FILE_SAVE_OW:
				{
					if(g_szFileName[0] == '\0')
					{
						char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024);
							if(GetSaveFileNameSingle(hGLWnd, "kdf", szFile, FALSE))
							{
								lstrcpy(g_szFileName, szFile);
							}else return TRUE;
						GlobalFree(szFile);
					}
					
					demo.Save(g_szFileName);
					RefreshAllView();
					break;
				}
				case ID_FILE_SAVE_AS:
				{
					char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024);
						if(GetSaveFileNameSingle(hGLWnd, "kdf", szFile, FALSE))
						{
							lstrcpy(g_szFileName, szFile);
							demo.Save(szFile);
							RefreshAllView();
						}
					GlobalFree(szFile);
					break;
				}
				case ID_FILE_EXPORT:
				{
					char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024);
						if(GetSaveFileNameSingle(hGLWnd, "kdb", szFile, FALSE))
						{
							//lstrcpy(g_szFileName, szFile);
							demo.BinarySave(szFile);
							MessageBox(hWnd, "Export done", "", MB_ICONINFORMATION|MB_OK|MB_TOPMOST);
							RefreshAllView();
						}
					GlobalFree(szFile);
					break;
				}
				case ID_FILE_EXIT:
				{
					VerifyOnExit();	
					break;
				}
				case ID_EDIT_UNDO:
				{
					Undo();	
					break;
				}
				case ID_EDIT_REDO:
				{
					Redo();	
					break;
				}
				case ID_MODE_LAYOUTER:
				{
					StopPlaying();

					nCurrentMode = LAYOUTER;
					HMENU hMenu = GetMenu(hWnd);
					HMENU hSub = GetSubMenu(hMenu, 2);
					CheckMenuItem(hSub, 1, MF_BYPOSITION|MF_UNCHECKED);
					CheckMenuItem(hSub, 0, MF_BYPOSITION|MF_CHECKED);

				
					//vSound.Hide();
					//vSynth.Hide();
					ShowWindow(vSound.GetHolderWnd(), FALSE);
					//ShowWindow(vTime.GetHolderWnd(), FALSE);
					ShowWindow(vSynth.GetHolderWnd(), FALSE);

					//ShowWindow(vScene.GetHolderWnd(), TRUE);
					ShowWindow(vClone.GetHolderWnd(), TRUE);
					ShowWindow(vObjectList.GetHolderWnd(), TRUE);
					ShowWindow(vSceneObjectList.GetHolderWnd(), TRUE);

					RefreshWindows();
					break;
				}
				case ID_MODE_TIMELINER:
				{
					StopPlaying();

					nCurrentMode = TIMELINER;
					HMENU hMenu = GetMenu(hWnd);
					HMENU hSub = GetSubMenu(hMenu, 2);
					CheckMenuItem(hSub, 0, MF_BYPOSITION|MF_UNCHECKED);
					CheckMenuItem(hSub, 1, MF_BYPOSITION|MF_CHECKED);

					//ShowWindow(vScene.GetHolderWnd(), FALSE;
					ShowWindow(vClone.GetHolderWnd(), FALSE);
					//ShowWindow(vSceneObjectList.GetHolderWnd(), FALSE);
					ShowWindow(vObjectList.GetHolderWnd(), FALSE);

					//vSound.Show();
					//vSynth.Show();
					ShowWindow(vSound.GetHolderWnd(), TRUE);
					//ShowWindow(vTime.GetHolderWnd(), TRUE);
					ShowWindow(vSynth.GetHolderWnd(), TRUE);

					RefreshWindows();
					break;
				}
				case ID_FRAME_000:
				case ID_FRAME_025:
				case ID_FRAME_050:
				case ID_FRAME_075:
				case ID_FRAME_100:
				{
					float mul = (LOWORD(wParam) - ID_FRAME_000) * 0.25f;
					UpdateFrameTransparency(mul);
					break;
				}
			}
			return FALSE;
		}
		case WM_DESTROY:
		case WM_CLOSE:
		{
			VerifyOnExit();
			return FALSE;
		}
		case WM_SIZE:
		{
			RefreshWindows();
			return FALSE;
		}
	}
	return TRUE;
}
Ejemplo n.º 17
0
FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
  if (m_bMouseDown)
    return FALSE;

  CPWL_Wnd::OnRButtonUp(point, nFlag);

  if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point))
    return TRUE;

  IFX_SystemHandler* pSH = GetSystemHandler();
  if (!pSH)
    return FALSE;

  SetFocus();

  CPVT_WordRange wrLatin = GetLatinWordsRange(point);
  CFX_WideString swLatin = m_pEdit->GetRangeText(wrLatin);

  FX_HMENU hPopup = pSH->CreatePopupMenu();
  if (!hPopup)
    return FALSE;

  CFX_ByteStringArray sSuggestWords;
  CPDF_Point ptPopup = point;

  if (!IsReadOnly()) {
    if (HasFlag(PES_SPELLCHECK) && !swLatin.IsEmpty()) {
      if (m_pSpellCheck) {
        CFX_ByteString sLatin = CFX_ByteString::FromUnicode(swLatin);

        if (!m_pSpellCheck->CheckWord(sLatin)) {
          m_pSpellCheck->SuggestWords(sLatin, sSuggestWords);

          int32_t nSuggest = sSuggestWords.GetSize();

          for (int32_t nWord = 0; nWord < nSuggest; nWord++) {
            pSH->AppendMenuItem(hPopup, WM_PWLEDIT_SUGGEST + nWord,
                                sSuggestWords[nWord].UTF8Decode());
          }

          if (nSuggest > 0)
            pSH->AppendMenuItem(hPopup, 0, L"");

          ptPopup = GetWordRightBottomPoint(wrLatin.EndPos);
        }
      }
    }
  }

  IPWL_Provider* pProvider = GetProvider();

  if (HasFlag(PES_UNDO)) {
    pSH->AppendMenuItem(
        hPopup, WM_PWLEDIT_UNDO,
        pProvider ? pProvider->LoadPopupMenuString(0) : L"&Undo");
    pSH->AppendMenuItem(
        hPopup, WM_PWLEDIT_REDO,
        pProvider ? pProvider->LoadPopupMenuString(1) : L"&Redo");
    pSH->AppendMenuItem(hPopup, 0, L"");

    if (!m_pEdit->CanUndo())
      pSH->EnableMenuItem(hPopup, WM_PWLEDIT_UNDO, FALSE);
    if (!m_pEdit->CanRedo())
      pSH->EnableMenuItem(hPopup, WM_PWLEDIT_REDO, FALSE);
  }

  pSH->AppendMenuItem(hPopup, WM_PWLEDIT_CUT,
                      pProvider ? pProvider->LoadPopupMenuString(2) : L"Cu&t");
  pSH->AppendMenuItem(hPopup, WM_PWLEDIT_COPY,
                      pProvider ? pProvider->LoadPopupMenuString(3) : L"&Copy");
  pSH->AppendMenuItem(
      hPopup, WM_PWLEDIT_PASTE,
      pProvider ? pProvider->LoadPopupMenuString(4) : L"&Paste");
  pSH->AppendMenuItem(
      hPopup, WM_PWLEDIT_DELETE,
      pProvider ? pProvider->LoadPopupMenuString(5) : L"&Delete");

  CFX_WideString swText = pSH->GetClipboardText(GetAttachedHWnd());
  if (swText.IsEmpty())
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE);

  if (!m_pEdit->IsSelected()) {
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE);
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, FALSE);
  }

  if (IsReadOnly()) {
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_DELETE, FALSE);
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE);
  }

  if (HasFlag(PES_PASSWORD)) {
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE);
  }

  if (HasFlag(PES_NOREAD)) {
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_CUT, FALSE);
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_COPY, FALSE);
  }

  pSH->AppendMenuItem(hPopup, 0, L"");
  pSH->AppendMenuItem(
      hPopup, WM_PWLEDIT_SELECTALL,
      pProvider ? pProvider->LoadPopupMenuString(6) : L"&Select All");

  if (m_pEdit->GetTotalWords() == 0) {
    pSH->EnableMenuItem(hPopup, WM_PWLEDIT_SELECTALL, FALSE);
  }

  int32_t x, y;
  PWLtoWnd(ptPopup, x, y);
  pSH->ClientToScreen(GetAttachedHWnd(), x, y);
  pSH->SetCursor(FXCT_ARROW);
  int32_t nCmd = pSH->TrackPopupMenu(hPopup, x, y, GetAttachedHWnd());

  switch (nCmd) {
    case WM_PWLEDIT_UNDO:
      Undo();
      break;
    case WM_PWLEDIT_REDO:
      Redo();
      break;
    case WM_PWLEDIT_CUT:
      CutText();
      break;
    case WM_PWLEDIT_COPY:
      CopyText();
      break;
    case WM_PWLEDIT_PASTE:
      PasteText();
      break;
    case WM_PWLEDIT_DELETE:
      Clear();
      break;
    case WM_PWLEDIT_SELECTALL:
      SelectAll();
      break;
    case WM_PWLEDIT_SUGGEST + 0:
      SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
             m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
      ReplaceSel(sSuggestWords[0].UTF8Decode().c_str());
      break;
    case WM_PWLEDIT_SUGGEST + 1:
      SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
             m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
      ReplaceSel(sSuggestWords[1].UTF8Decode().c_str());
      break;
    case WM_PWLEDIT_SUGGEST + 2:
      SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
             m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
      ReplaceSel(sSuggestWords[2].UTF8Decode().c_str());
      break;
    case WM_PWLEDIT_SUGGEST + 3:
      SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
             m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
      ReplaceSel(sSuggestWords[3].UTF8Decode().c_str());
      break;
    case WM_PWLEDIT_SUGGEST + 4:
      SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),
             m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
      ReplaceSel(sSuggestWords[4].UTF8Decode().c_str());
      break;
    default:
      break;
  }

  pSH->DestroyMenu(hPopup);

  return TRUE;
}
Ejemplo n.º 18
0
void wxTextCtrl::OnRedo( wxCommandEvent& WXUNUSED(rEvent) )
{
    Redo();
} // end of wxTextCtrl::OnRedo
Ejemplo n.º 19
0
void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
{
    Redo();
}
Ejemplo n.º 20
0
void IWnd_stc::OnKeyEvent(wxKeyEvent& evt)
{
	int kc = evt.GetRawKeyCode();

	if(kc==wxSTC_KEY_TAB)
	{
		if(evt.ShiftDown())
		{
			CmdKeyExecute (wxSTC_CMD_BACKTAB);
		}
		else
		{
			CmdKeyExecute (wxSTC_CMD_TAB);
		}
		return;
	}

	if(evt.ControlDown())
	{
		switch(kc)
		{
		case 'C':
			{
				Copy();
			}
			return;
		case 'X':
			{
				Cut();
			}
			return;
		case 'V':
			{
				Paste();
			}
			return;
		case 'A':
			{
				SelectAll();
			}
			return;
		case 'Z':
			{
				Undo();
			}
			return;
		case 'R':
			{
				Redo();
			}
			return;
		case 'D':
			{
				this->Clear();
			}
			return;
		//case 'F':
		//	if(style.get(STYLE_CAN_FIND))
		//	{
		//		WndManager::current().evtmgr["Find"].CmdExecuteEx(-1);
		//		evt.Skip();
		//		return;
		//	}
		//	break;
		//case 'H':
		//	if(style.get(STYLE_CAN_REPLACE))
		//	{
		//		WndManager::current().evtmgr["Replace"].CmdExecuteEx(-1);
		//		evt.Skip();
		//		return;
		//	}
		//	break;
		};
	}

	evt.Skip();
}
Ejemplo n.º 21
0
void fbtTextFile::redoEvent(wxCommandEvent& evt)
{
	if (!CanRedo())
		return;
	Redo();
}
Ejemplo n.º 22
0
void FB_STC::OnRedo ( wxCommandEvent& event ) {
    if (!CanRedo()) return;
    Redo ();
}
Ejemplo n.º 23
0
ECEditorWindow::ECEditorWindow(Framework* fw, QWidget *parent) :
    QWidget(parent),
    framework(fw),
    toggleEntitiesButton(0),
    entityList(0),
    ecBrowser(0),
    hasFocus(true)
{
    QUiLoader loader;
    loader.setLanguageChangeEnabled(true);
    QFile file(Application::InstallationDirectory() + "data/ui/eceditor.ui");
    file.open(QFile::ReadOnly);
    if (!file.exists())
    {
        LogError("Cannot find " + Application::InstallationDirectory() + "data/ui/eceditor.ui file.");
        return;
    }

    QWidget *contents = loader.load(&file, this);
    if (!contents)
    {
        LogError("Could not load editor layout");
        return;
    }
    contents->installEventFilter(this);
    file.close();

    Scene *scene = fw->Scene()->MainCameraScene();
    assert(scene);
    undoManager_ = new UndoManager(scene->shared_from_this(), this);
    transformEditor = new TransformEditor(scene->shared_from_this(), undoManager_);

    QVBoxLayout *layout = new QVBoxLayout(this);
    undoButton_ = findChild<QToolButton *>("undoButton");
    undoButton_->setDisabled(true);
    redoButton_ = findChild<QToolButton *>("redoButton");
    redoButton_->setDisabled(true);

    undoButton_->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/undo-icon.png"));
    redoButton_->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/redo-icon.png"));

    undoButton_->setMenu(undoManager_->UndoMenu());
    redoButton_->setMenu(undoManager_->RedoMenu());

    layout->addWidget(contents);
    layout->setContentsMargins(0,0,0,0);
    setLayout(layout);
    setWindowTitle(contents->windowTitle());
    resize(contents->size());

    toggleEntitiesButton = findChild<QPushButton *>("but_show_entities");
    entityList = findChild<QListWidget*>("list_entities");
    QWidget *entity_widget = findChild<QWidget*>("entity_widget");
    if(entity_widget)
        entity_widget->hide();

    QWidget *browserWidget = findChild<QWidget*>("browser_widget");
    if (browserWidget)
    {
        ecBrowser = new ECBrowser(framework, this, browserWidget);
        ecBrowser->setMinimumWidth(100);
        QVBoxLayout *property_layout = dynamic_cast<QVBoxLayout *>(browserWidget->layout());
        if (property_layout)
            property_layout->addWidget(ecBrowser);
    }

    ECEditorModule *ecEditorModule = framework->GetModule<ECEditorModule>();
    if (ecBrowser)
    {
        // signals from attribute browser to editor window.
        connect(ecBrowser, SIGNAL(ShowXmlEditorForComponent(const QString &)), SLOT(ShowXmlEditorForComponent(const QString &)));
        connect(ecBrowser, SIGNAL(CreateNewComponent()), SLOT(CreateComponent()));
        connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
            SLOT(HighlightEntities(const QString&, const QString&)));
        connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
            SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)), Qt::UniqueConnection);

        ecBrowser->SetItemExpandMemory(ecEditorModule->ExpandMemory());
    }

    if (entityList)
    {
        entityList->setSelectionMode(QAbstractItemView::ExtendedSelection);
        connect(entityList, SIGNAL(itemSelectionChanged()), this, SLOT(RefreshPropertyBrowser()));
        connect(entityList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ShowEntityContextMenu(const QPoint &)));
    }

    if (toggleEntitiesButton)
        connect(toggleEntitiesButton, SIGNAL(pressed()), this, SLOT(ToggleEntityList()));

    QPushButton *expandOrCollapseButton = findChild<QPushButton *>("expandOrCollapseButton");
    if (expandOrCollapseButton && ecBrowser)
        connect(expandOrCollapseButton, SIGNAL(clicked()), ecBrowser, SLOT(ExpandOrCollapseAll()));

    connect(scene, SIGNAL(EntityRemoved(Entity*, AttributeChange::Type)), SLOT(RemoveEntity(Entity*)), Qt::UniqueConnection);
    connect(scene, SIGNAL(ActionTriggered(Entity *, const QString &, const QStringList &, EntityAction::ExecTypeField)),
        SLOT(OnActionTriggered(Entity *, const QString &, const QStringList &)), Qt::UniqueConnection);

    connect(this, SIGNAL(FocusChanged(ECEditorWindow *)), ecEditorModule, SLOT(ECEditorFocusChanged(ECEditorWindow*)));
    connect(this, SIGNAL(EditEntityXml(const QList<EntityPtr> &)), ecEditorModule, SLOT(CreateXmlEditor(const QList<EntityPtr> &)));
    connect(this, SIGNAL(EditComponentXml(const QList<ComponentPtr> &)), ecEditorModule, SLOT(CreateXmlEditor(const QList<ComponentPtr> &)));
    //connect(this, SIGNAL(AttributeAboutToBeEdited(IAttribute *)), this, SLOT(OnAboutToEditAttribute(IAttribute* )));
    connect(undoManager_, SIGNAL(CanUndoChanged(bool)), this, SLOT(OnUndoChanged(bool)));
    connect(undoManager_, SIGNAL(CanRedoChanged(bool)), this, SLOT(OnRedoChanged(bool)));
    connect(undoButton_, SIGNAL(clicked()), undoManager_, SLOT(Undo()));
    connect(redoButton_, SIGNAL(clicked()), undoManager_, SLOT(Redo()));
}
Ejemplo n.º 24
0
int CEdit::MsgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
    switch (msg)
    {
    case WM_INITDIALOG:
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            BeginPaint(hWnd,&ps);
            Redraw();
            EndPaint(hWnd,&ps);
        }
        break;
    case WM_LBUTTONUP:
        lbutton=false;
        HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam);        
        PostMessage(hWnd,WM_PAINT,0,0);
        break;
    case WM_LBUTTONDOWN:
        lbutton=true;
        HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam);
        PostMessage(hWnd,WM_PAINT,0,0);
        break;
    case WM_RBUTTONUP:
        rbutton=false;
        HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam);
        PostMessage(hWnd,WM_PAINT,0,0);
        break;
    case WM_RBUTTONDOWN:
        rbutton=true;
        HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam);
        PostMessage(hWnd,WM_PAINT,0,0);
        break;  
    case WM_MOUSEMOVE:
        HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam);
        break;
    case WM_VSCROLL:
        if((HWND)lParam == GetDlgItem(hWnd, IDC_LUMINABAR))
        {
            switch(LOWORD(wParam))
            {
            case SB_TOP:
                nLumina=0;
                break;
            case SB_BOTTOM:
                nLumina=255;
                break;
            case SB_LINEUP:
                if (nLumina)
                    nLumina--;
                break;
            case SB_LINEDOWN:
                if (nLumina<255)
                    nLumina++;
                break;
            case SB_PAGEUP:
                nLumina-=10;
                if (nLumina<0)      nLumina=0;
                break;
            case SB_PAGEDOWN:
                nLumina+=10;
                if (nLumina>255)    nLumina=255;
                break;
            case SB_THUMBPOSITION:
            case SB_THUMBTRACK:
                nLumina=HIWORD(wParam);
                break;
            }
            UpdateLumina((HWND)lParam);
        } 
        else if ((HWND)lParam == GetDlgItem(hWnd, IDC_ALPHABAR))
        {
            switch(LOWORD(wParam))
            {
            case SB_TOP:
                nAlpha=0;
                break;
            case SB_BOTTOM:
                nAlpha=255;
                break;
            case SB_LINEUP:
                if (nAlpha)
                    nAlpha--;
                break;
            case SB_LINEDOWN:
                if (nAlpha<255)
                    nAlpha++;
                break;
            case SB_PAGEUP:
                nAlpha-=10;
                if (nAlpha<0)       nAlpha=0;
                break;
            case SB_PAGEDOWN:
                nAlpha+=10;
                if (nAlpha>255)     nAlpha=255;
                break;
            case SB_THUMBPOSITION:
            case SB_THUMBTRACK:
                nAlpha=HIWORD(wParam);
                break;
            }
            UpdateAlpha((HWND)lParam);
        }
        PostMessage(hWnd,WM_PAINT,0,0);
        break;
        
    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
        case ID_TILEED_NEXT:    GoNext();                           break;
        case ID_TILEED_PREV:    GoPrev();                           break;
            
        case ID_TILEED_UNDO:    Undo();                             break;
        case ID_TILEED_REDO:    Redo();                             break;
            
        case ID_TILEED_CLEAR:   curimage.Clear(nCurcolour[1]);      break;
        case ID_TILEED_ROTATE:  curimage.Rotate();                  break;
        case ID_TILEED_FLIP:    curimage.Flip();                    break;
        case ID_TILEED_MIRROR:  curimage.Mirror();                  break;
        case ID_TILEED_EXIT:    PostMessage(hWnd, WM_CLOSE, 0, 0);  break;
        default:
            return HandleCommand(hWnd,wParam);                                                                                // unknown message?  Pass it down to the derived class
        }
        
        PostMessage(hWnd,WM_PAINT,0,0);
        break;
    case WM_CLOSE:
        EndDialog(hWnd,0);
        break;
    }
    return 0;
}
Ejemplo n.º 25
0
void wxComboBox::OnRedo(wxCommandEvent& WXUNUSED(event))
{
    Redo();
}
Ejemplo n.º 26
0
int MDLViewer::handleEvent (mxEvent *event)
{
	int iret = 0;

	switch (event->event)
	{
	case mxEvent::Size:
		{
			int width = w2();
			int height = h2();

			workspace->setBounds( 0, 0, width, height - WINDOW_TAB_OFFSET );
			int gridsettingswide = 100;
			int gridstart = width - gridsettingswide - 5;
			int windowwide = gridstart * 0.6f;
			int modelwide = gridstart * 0.4f;

			gridsettings->setBounds( gridstart, height - WINDOW_TAB_OFFSET + 1, gridsettingswide, WINDOW_TAB_OFFSET - 2 );

			windowtab->setBounds( 0, height - WINDOW_TAB_OFFSET, windowwide, WINDOW_TAB_OFFSET );
			modeltab->setBounds( windowwide, height - WINDOW_TAB_OFFSET, modelwide, WINDOW_TAB_OFFSET );

			iret = 1;
		}
		break;
	case mxEvent::Action:
		{
			iret = 1;
			switch (event->action)
			{
			case IDC_WINDOW_TAB:
				{
					windowtab->HandleWindowSelect();
				}
				break;
			case IDC_MODEL_TAB:
				{
					modeltab->HandleModelSelect();
				}
				break;
			case IDC_EDIT_COPY:
				{
					Copy();
				}
				break;
				
			case IDC_EDIT_PASTE:
				{
					Paste();
				}
				break;
				
			case IDC_EDIT_UNDO:
				{
					Undo();
				}
				break;
				
			case IDC_EDIT_REDO:
				{
					Redo();
				}
				break;
				
			case IDC_FILE_LOADMODEL:
				{
					const char *ptr = mxGetOpenFileName(
						this, 
						FacePoser_MakeWindowsSlashes( va( "%s/models/", GetGameDirectory() ) ),
						"*.mdl");
					if (ptr)
					{
						LoadModelFile( ptr );
					}
				}
				break;
				
			case IDC_FILE_REFRESH:
				{
					Refresh();
					break;
				}
				
			case IDC_FILE_LOADBACKGROUNDTEX:
			case IDC_FILE_LOADGROUNDTEX:
				{
					const char *ptr = mxGetOpenFileName (this, 0, "*.*");
					if (ptr)
					{
						if (0 /* g_pMatSysWindow->loadTexture (ptr, event->action - IDC_FILE_LOADBACKGROUNDTEX) */)
						{
							if (event->action == IDC_FILE_LOADBACKGROUNDTEX)
								g_pControlPanel->setShowBackground (true);
							else
								g_pControlPanel->setShowGround (true);
							
						}
						else
							mxMessageBox (this, "Error loading texture.", g_appTitle, MX_MB_OK | MX_MB_ERROR);
					}
				}
				break;
				
			case IDC_FILE_UNLOADGROUNDTEX:
				{
					// g_pMatSysWindow->loadTexture (0, 1);
					g_pControlPanel->setShowGround (false);
				}
				break;
				
			case IDC_FILE_RECENTMODELS1:
			case IDC_FILE_RECENTMODELS2:
			case IDC_FILE_RECENTMODELS3:
			case IDC_FILE_RECENTMODELS4:
				{
					int i = event->action - IDC_FILE_RECENTMODELS1;
					
					LoadModelFile( recentFiles[ i ] );
					
					char tmp[256];			
					strcpy (tmp, recentFiles[0]);
					strcpy (recentFiles[0], recentFiles[i]);
					strcpy (recentFiles[i], tmp);
					
					initRecentFiles ();
					
					redraw ();
				}
				break;
				
			case IDC_FILE_EXIT:
				{
					redraw ();
					mx::quit ();
				}
				break;
				
			case IDC_OPTIONS_COLORBACKGROUND:
			case IDC_OPTIONS_COLORGROUND:
			case IDC_OPTIONS_COLORLIGHT:
				{
					float *cols[3] = { g_viewerSettings.bgColor, g_viewerSettings.gColor, g_viewerSettings.lColor };
					float *col = cols[event->action - IDC_OPTIONS_COLORBACKGROUND];
					int r = (int) (col[0] * 255.0f);
					int g = (int) (col[1] * 255.0f);
					int b = (int) (col[2] * 255.0f);
					if (mxChooseColor (this, &r, &g, &b))
					{
						col[0] = (float) r / 255.0f;
						col[1] = (float) g / 255.0f;
						col[2] = (float) b / 255.0f;
					}
				}
				break;
				
			case IDC_OPTIONS_CENTERVIEW:
				g_pControlPanel->centerView ();
				break;
				
			case IDC_OPTIONS_CENTERONFACE:
				g_pControlPanel->CenterOnFace();
				break;
				
			case IDC_OPTIONS_MAKESCREENSHOT:
				{
					char *ptr = (char *) mxGetSaveFileName (this, "", "*.tga");
					if (ptr)
					{
						if (!strstr (ptr, ".tga"))
							strcat (ptr, ".tga");
						// g_pMatSysWindow->dumpViewport (ptr);
					}
				}
				break;
				
			case IDC_OPTIONS_DUMP:
				g_pControlPanel->dumpModelInfo ();
				break;
				
#ifdef WIN32
			case IDC_HELP_GOTOHOMEPAGE:
				ShellExecute (0, "open", "http://www.swissquake.ch/chumbalum-soft/index.html", 0, 0, SW_SHOW);
				break;
#endif
				
			case IDC_HELP_ABOUT:
				mxMessageBox (this,
					"v0.1 (c) 2001, Valve, LLC.  All rights reserved.\r\nBuild Date: "__DATE__"",
					"Valve Face Poser", 
					MX_MB_OK | MX_MB_INFORMATION);
				break;
				
			case IDC_EXPRESSIONS_REDOBITMAPS:
				{
					bool saveOverrides = g_pExpressionTrayTool->GetOverridesShowing();
					g_pExpressionTrayTool->SetOverridesShowing( false );
					CExpClass *active = expressions->GetActiveClass();
					if ( active )
					{
						for ( int i = 0; i < active->GetNumExpressions() ; i++ )
						{
							CExpression *exp = active->GetExpression( i );
							if ( !exp )
								continue;
							
							active->SelectExpression( i );
							exp->CreateNewBitmap( models->GetActiveModelIndex() );
							
							if ( ! ( i % 5 ) )
							{
								g_pExpressionTrayTool->redraw();
							}
						}
						
						if ( active->HasOverrideClass() )
						{
							
							g_pExpressionTrayTool->SetOverridesShowing( true );
							
							CExpClass *oc = active->GetOverrideClass();
							for ( int i = 0; i < oc->GetNumExpressions() ; i++ )
							{
								CExpression *exp = oc->GetExpression( i );
								if ( !exp )
									continue;
								
								oc->SelectExpression( i );
								exp->CreateNewBitmap( models->GetActiveModelIndex() );
								
								if ( ! ( i % 5 ) )
								{
									g_pExpressionTrayTool->redraw();
								}
							}
						}
						active->SelectExpression( 0 );
					}
					
					g_pExpressionTrayTool->SetOverridesShowing( saveOverrides );
				}
				break;
			case IDC_EXPRESSIONS_NEW:
				{
					const char *filename = mxGetSaveFileName( 
						this, 
						FacePoser_MakeWindowsSlashes( va( "%s/expressions/", GetGameDirectory() ) ), 
						"*.txt" );
					if ( filename && filename[ 0 ] )
					{
						char classfile[ 512 ];
						strcpy( classfile, filename );
						StripExtension( classfile );
						DefaultExtension( classfile, ".txt" );
						
						expressions->CreateNewClass( classfile );
					}
				}
				break;
			case IDC_EXPRESSIONS_LOAD:
				{
					const char *filename = NULL;
					
					filename = mxGetOpenFileName( 
						this, 
						FacePoser_MakeWindowsSlashes( va( "%s/expressions/", GetGameDirectory() ) ), 
						"*.txt" );
					if ( filename && filename[ 0 ] )
					{
						expressions->LoadClass( filename );
					}
				}
				break;
				
			case IDC_EXPRESSIONS_SAVE:
				{
					CExpClass *active = expressions->GetActiveClass();
					if ( active )
					{
						active->Save();
						active->Export();
					}
				}
				break;
			case IDC_EXPRESSIONS_EXPORT:
				{
					CExpClass *active = expressions->GetActiveClass();
					if ( active )
					{
						active->Export();
					}
				}
				break;
			case IDC_EXPRESSIONS_CLOSE:
				g_pControlPanel->Close();
				break;
			case IDC_EXPRESSIONS_CLOSEALL:
				g_pControlPanel->Closeall();
				break;
			case IDC_CHOREOSCENE_NEW:
				g_pChoreoView->New();
				break;
			case IDC_CHOREOSCENE_LOAD:
				g_pChoreoView->Load();
				break;
			case IDC_CHOREOSCENE_SAVE:
				g_pChoreoView->Save();
				break;
			case IDC_CHOREOSCENE_SAVEAS:
				g_pChoreoView->SaveAs();
				break;
			case IDC_CHOREOSCENE_CLOSE:
				g_pChoreoView->Close();
				break;
			case IDC_CHOREOSCENE_ADDACTOR:
				g_pChoreoView->NewActor();
				break;
			case IDC_WINDOW_TILE:
				{
					OnTile();
				}
				break;
			case IDC_WINDOW_TILE_HORIZ:
				{
					OnTileHorizontally();
				}
				break;
			case IDC_WINDOW_TILE_VERT:
				{
					OnTileVertically();
				}
				break;
			case IDC_WINDOW_CASCADE:
				{
					OnCascade();
				}
				break;
			case IDC_WINDOW_HIDEALL:
				{
					OnHideAll();
				}
				break;
			case IDC_WINDOW_SHOWALL:
				{
					OnShowAll();
				}
				break;
			default:
				{
					iret = 0;
					int tool_number = event->action - IDC_WINDOW_FIRSTTOOL;
					int max_tools = IDC_WINDOW_LASTTOOL - IDC_WINDOW_FIRSTTOOL;
					
					if ( tool_number >= 0 && 
						tool_number <= max_tools && 
						tool_number < IFacePoserToolWindow::GetToolCount() )
					{
						iret = 1;
						IFacePoserToolWindow *tool = IFacePoserToolWindow::GetTool( tool_number );
						if ( tool )
						{
							mxWindow *toolw = tool->GetMxWindow();
							
							bool wasvisible = toolw->isVisible();
							toolw->setVisible( !wasvisible );
							
							g_MDLViewer->UpdateWindowMenu();

						}
					}
				}
				break;
			} //switch (event->action)
		} // mxEvent::Action
		break;
	case KeyDown:
		{
			g_pMatSysWindow->handleEvent(event);
			iret = 1;
		}
		break;
	case mxEvent::Activate:
		{
			if (event->action)
			{
				mx::setIdleWindow( g_pMatSysWindow );
			}
			else
			{
				mx::setIdleWindow( 0 );
			}
			iret = 1;
		}
		break;
	} // event->event
	
	return iret;
}
Ejemplo n.º 27
0
// edit event handlers
void Edit::OnEditRedo (wxCommandEvent &WXUNUSED(event)) {
    if (!CanRedo()) return;
    Redo ();
}
Ejemplo n.º 28
0
CCommandVar CActorTools::CommandRedo(CCommandVar p1, CCommandVar p2)
{
    if(!Redo())	ELog.Msg( mtInformation, "Redo buffer empty" );
    else		return ExecCommand(COMMAND_CHANGE_ACTION, etaSelect);
    return FALSE;
}
Ejemplo n.º 29
0
FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) {
  if (m_bMouseDown)
    return TRUE;

  CPWL_Wnd::OnChar(nChar, nFlag);

  // FILTER
  switch (nChar) {
    case 0x0A:
    case 0x1B:
      return FALSE;
    default:
      break;
  }

  FX_BOOL bCtrl = IsCTRLpressed(nFlag);
  FX_BOOL bAlt = IsALTpressed(nFlag);
  FX_BOOL bShift = IsSHIFTpressed(nFlag);

  uint16_t word = nChar;

  if (bCtrl && !bAlt) {
    switch (nChar) {
      case 'C' - 'A' + 1:
        CopyText();
        return TRUE;
      case 'V' - 'A' + 1:
        PasteText();
        return TRUE;
      case 'X' - 'A' + 1:
        CutText();
        return TRUE;
      case 'A' - 'A' + 1:
        SelectAll();
        return TRUE;
      case 'Z' - 'A' + 1:
        if (bShift)
          Redo();
        else
          Undo();
        return TRUE;
      default:
        if (nChar < 32)
          return FALSE;
    }
  }

  if (IsReadOnly())
    return TRUE;

  if (m_pEdit->IsSelected() && word == FWL_VKEY_Back)
    word = FWL_VKEY_Unknown;

  Clear();

  switch (word) {
    case FWL_VKEY_Back:
      Backspace();
      break;
    case FWL_VKEY_Return:
      InsertReturn();
      break;
    case FWL_VKEY_Unknown:
      break;
    default:
      InsertWord(word, GetCharSet());
      break;
  }

  return TRUE;
}
Ejemplo n.º 30
0
/* handle all WM_COMMAND messages here */
LONG WINAPI CommandHandler (
    HWND    hWnd,
    WPARAM  wParam,
    LPARAM  lParam)
{
	unsigned short	cmd;

	cmd = LOWORD(wParam);

    switch (cmd)
    {
		//
		// file menu
		//
	case ID_FILE_RESAMPLESKIN:
		ResampleSkin ();
		break;

	case ID_FILE_NEWSKIN:
		NewSkin ();
		break;

	case ID_FILE_OPENFRAME:
		OpenFrameDialog ();
		break;

	case ID_FILE_OPENSKIN:
		if (!ConfirmModified())
			break;
		OpenSkinDialog ();
		break;

	case ID_FILE_RELOADSKIN:
		if (!ConfirmModified())
			break;
		Skin_LoadFile (skin_filename);
		break;

	case ID_FILE_SAVESKIN:
		Skin_SaveFile (skin_filename);
		break;

	case ID_FILE_SAVESKINAS:
		SaveSkinDialog ();
		break;
	case ID_FILE_EXIT:
		if (!ConfirmModified())
			break;
        PostQuitMessage (0);
		break;

		//
		// edit menu
		//
	case ID_EDIT_UNDO:
		Undo();
		break;
	case ID_EDIT_REDO:
		Redo();
		break;

		//
		// view menu
		//
	case ID_VIEW_MODELLINES:
		model_lines ^= 1;
		CheckMenuItem ( GetSubMenu (GetMenu(mainwindow), MENU_VIEW)
			, ID_VIEW_MODELLINES
			, MF_BYCOMMAND | (model_lines ? MF_CHECKED : MF_UNCHECKED)  );
		InvalidateRect (camerawindow, NULL, false);
		break;
	case ID_VIEW_TEXTURELINES:
		skin_lines ^= 1;
		CheckMenuItem ( GetSubMenu (GetMenu(mainwindow), MENU_VIEW)
			, ID_VIEW_TEXTURELINES
			, MF_BYCOMMAND | (skin_lines ? MF_CHECKED : MF_UNCHECKED)  );
		InvalidateRect (skinwindow, NULL, false);
		break;
	default:
        return FALSE;
    }

    return TRUE;
}