Exemplo n.º 1
0
void HtmlExportWindow::onOk(wxCommandEvent&) {
	ExportTemplateP exp = list->getSelection<ExportTemplate>();
	// get filename
	String name = wxFileSelector(_TITLE_("save html"),settings.default_export_dir,_(""),_(""),exp->file_type, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
	if (name.empty()) return;
	settings.default_export_dir = wxPathOnly(name);
	// export
	export_set(set, getSelection(), exp, name);
	// Done
	EndModal(wxID_OK);
}
Exemplo n.º 2
0
SimSet* SimTreeView::getSelectedParent()
{
   HTREEITEM hItem;
   SimObject *obj;
   if ( (hItem = getSelection()) != NULL )
      if ( (hItem = getParent( hItem )) != NULL )
         if ( (obj = getObject( hItem )) != NULL )
            return( dynamic_cast<SimSet*>(obj) );

   return NULL;
}   
Exemplo n.º 3
0
void CmdRaytracingResetCamera::activated(int iMsg)
{
    std::vector<App::DocumentObject*> sel = getSelection().getObjectsOfType(Raytracing::RayProject::getClassTypeId());
    if (sel.size() != 1) {
        sel = getSelection().getObjectsOfType(Raytracing::LuxProject::getClassTypeId());
        if (sel.size() != 1) {
            QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
                QObject::tr("Select one Raytracing project object."));
            return;
        }
    }

    if (sel.front()->getTypeId().isDerivedFrom(Raytracing::RayProject::getClassTypeId())) {
        //povray
        try {
            openCommand("Reset Raytracing Camera");
            doCommand(Doc,"import RaytracingGui");
            doCommand(Doc,"App.activeDocument().%s.Camera = RaytracingGui.povViewCamera()",sel.front()->getNameInDocument());
            commitCommand();
            updateActive();
        }
        catch (...) {
            abortCommand();
            throw;
        }
    }
    else if (sel.front()->getTypeId().isDerivedFrom(Raytracing::LuxProject::getClassTypeId())) {
        //luxrender
        try {
            openCommand("Reset Raytracing Camera");
            doCommand(Doc,"import RaytracingGui");
            doCommand(Doc,"App.activeDocument().%s.Camera = RaytracingGui.luxViewCamera()",sel.front()->getNameInDocument());
            commitCommand();
            updateActive();
        }
        catch (...) {
            abortCommand();
            throw;
        }
    }
}
Exemplo n.º 4
0
int main()
{
	int userInput;
	struct Node* head;
	struct Node* tail;
	head = NULL;
	tail = NULL;
	
	printWelcomeMsg();
	
	userInput = 0;
	while (userInput != -1) {
		userInput = getSelection("Enter your selection: ");		
		if(userInput == 1) {
			userInput = getSelection("Enter the value to append to head: ");
			insertAtHead(&head, &tail, userInput);
		} else if (userInput == 2) {
			userInput = getSelection("Enter the value to append to tail: ");
			insertAtTail(&tail, &head, userInput);
		} else if (userInput == -1) {
			printExitMessage();
			scanf("%d", &userInput);
			printf("\n");
			if (userInput == 1) {
				printForward(tail);
			} else if (userInput == 2) {
				printReverse(head);
			} else {
				printf("\nExiting without displaying output.");
			}
			return 0;
		}
		else {
			printf("You've made an error. Please try again.\n\n");
		}
	}

	printForward(tail);
	
	return 0;
}
Exemplo n.º 5
0
void SettingsDialog::moveUpStation()
{
    if ( getSelection() )
    {
        if ( selectedStation > 0 )
        {
            stationList.swap( selectedStation, selectedStation - 1 );
            selectedStation -= 1;
            updateStationsTable();
        }
    }
}
Exemplo n.º 6
0
void CSVRender::WorldspaceWidget::centerOrbitCameraOnSelection()
{
    std::vector<osg::ref_ptr<TagBase> > selection = getSelection(~0);

    for (std::vector<osg::ref_ptr<TagBase> >::iterator it = selection.begin(); it!=selection.end(); ++it)
    {
        if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag*> (it->get()))
        {
            mOrbitCamControl->setCenter(objectTag->mObject->getPosition().asVec3());
        }
    }
}
Exemplo n.º 7
0
void SettingsDialog::moveDownStation()
{
    if ( getSelection() )
    {
        if ( selectedStation < stationList.count() - 1 )
        {
            stationList.swap( selectedStation, selectedStation + 1 );
            selectedStation += 1;
            updateStationsTable();
        }
    }
}
Exemplo n.º 8
0
void TextEdit::slotClicked(int,int)
{
#if QT_VERSION >= 300
    int paraFrom, paraTo, indexFrom, indexTo;
    getSelection(&paraFrom, &indexFrom, &paraTo, &indexTo);
    if ((paraFrom != paraTo) || (indexFrom != indexTo))
        return;
    m_bInClick = true;
    QContextMenuEvent e(QContextMenuEvent::Other, QPoint(0, 0), QPoint(0, 0), 0);
    contentsContextMenuEvent(&e);
    m_bInClick = false;
#endif
}
Exemplo n.º 9
0
void CPetRoomsGlyph::selectGlyph(const Point &topLeft, const Point &pt) {
	if (isAssigned()) {
		bool isShiftPressed = g_vm->_window->getSpecialButtons() & MK_SHIFT;

		if (isShiftPressed) {
			int selection = getSelection(topLeft, pt);
			if (selection >= 0)
				_roomFlags |= 1 << selection;
		}

		updateTooltip();
	}
}
Exemplo n.º 10
0
void XournalView::clearSelection()
{
	XOJ_CHECK_TYPE(XournalView);

	EditSelection* sel = GTK_XOURNAL(widget)->selection;
	GTK_XOURNAL(widget)->selection = NULL;
	delete sel;

	control->setClipboardHandlerSelection(getSelection());

	getCursor()->setMouseSelectionType(CURSOR_SELECTION_NONE);
	control->getToolHandler()->setSelectionEditTools(false, false, false);
}
Exemplo n.º 11
0
Arquivo: Menu.C Projeto: bbidulock/wmx
ChannelMenu::ChannelMenu(WindowManager *manager, XEvent *e)
    : Menu(manager, e), m_channels(manager->channels()),
      m_channel(manager->channel())
{
    XButtonEvent *ev = (XButtonEvent *)e;

    Client *c = m_windowManager->windowToClient(ev->window);
    ev->x = ev->x_root; ev->y = ev->y_root;
	
    int channel = getSelection() + 1;

    m_windowManager->gotoChannel(channel, c);
}
Exemplo n.º 12
0
// Update the attributes table
void ShaderSelector::updateInfoTable() {

	gtk_list_store_clear(_infoStore);

	// Get the selected texture name. If nothing is selected, we just leave the
	// infotable empty.
	std::string selName = getSelection();

	// Notify the client of the change to give it a chance to update the infostore
	if (_client != NULL && !selName.empty()) {
		_client->shaderSelectionChanged(selName, _infoStore);
	}
}
Exemplo n.º 13
0
void Game::run()
{
	int selection;
	string filename, tester;
	ifstream testStream;
	
	display("\nWelcome to the adventure game!\n");
	
	do {
		display("\nWhat will you do? (enter the number corresponding to your selection)\n 1. New game\n 2. Load game\n 0. Quit game\n");
		selection = getSelection();
		switch (selection) {
			case 1:
				cout << '\n';
				if (loadDefaultData() == OK)
					playGame();
				break;
			case 0:
				break;
			case 2:
				display("\nWhat is the name of your save file? (press enter to cancel)\n");
				getline(cin, filename);
				
				testStream.open(filename.c_str());
				getline(testStream, tester);
				if (filename != "") {
					if (tester != "start_save_file") {
						stringstream output;
						output << "\nSorry, " << filename << " is not the name of a valid save file.  Try again.\n";
						display(output.str());
						selection = -1;
						break;
					}
					testStream.close();
				
					if (loadGame(filename) == ERROR)
						cout << "Error: something went wrong with loadGame().\n";
					else {
						cout << '\n';
						playGame(filename);
					}
				}
				break;
			default:
				display("Invalid selection. Try again.\n");
				break;
		}
	} while (selection != 0);
	
	display("\nGood bye! Thanks for playing!\n\n");
}
Exemplo n.º 14
0
void Editor::updateSelectionOrigin()
{
    int lineFrom, indexFrom, lineTo, indexTo;
    getSelection(&lineFrom, &indexFrom, &lineTo, &indexTo);
    if (lineFrom == -1)
    {
        selectionOrigin.line = -1;
        selectionOrigin.index = -1;
    } else if (selectionOrigin.line == -1)
    {
        selectionOrigin.line = lineFrom;
        selectionOrigin.index = indexFrom;
    }
}
void CCommands::FreezeSelection() {
CComBSTR file;
CComBSTR token;
long line;
long column;
long offset;

    getSelection(file,token,offset,line,column);
	m_SelectedFile = file.m_str;
	m_SelectedFile.Replace("\\","/");
	m_SelectedLine = line;
	m_SelectedColumn = column;
	m_SelectedLength = token.Length();
}
Exemplo n.º 16
0
void SonicPiScintilla::moveLineOrSelection(int numLines) {
  beginUndoAction();

  int linenum, cursor, origLinenum, origCursor;
  getCursorPosition(&linenum, &cursor);
  origLinenum = linenum;
  origCursor = cursor;

  bool hadSelectedText = hasSelectedText();


  if(!hadSelectedText) {
    setSelection(linenum, 0, linenum + 1, 0);
  }

  int lineFrom, indexFrom, lineTo, indexTo, lineOffset;
  getSelection(&lineFrom, &indexFrom, &lineTo, &indexTo);
  lineOffset = lineTo - origLinenum;
  linenum = lineFrom;

  QString selection = selectedText();

  if(selection[selection.length()-1] != '\n') {
    selection = selection + "\n";
    lineTo += 1;
    lineOffset += 1;
    indexTo = 0;
    replaceSelectedText("");
    setCursorPosition(linenum, 0);
    SendScintilla(SCI_DELETEBACK);
  } else {
    replaceSelectedText("");
  }
  setCursorPosition(linenum, 0);

  moveLines(numLines);

  getCursorPosition(&linenum, &cursor);
  setCursorPosition(linenum, 0);
  insert(selection);

  setCursorPosition(linenum + lineOffset, origCursor);

  int diffLine = lineTo - lineFrom;
  int diffIndex = indexTo - indexFrom;

  setSelection(linenum + diffLine, diffIndex, linenum, 0);

  endUndoAction();
}
Exemplo n.º 17
0
void CmdRaytracingExportProject::activated(int)
{
    QString filterLabel;
    unsigned int n = getSelection().countObjectsOfType(Raytracing::RayProject::getClassTypeId());
    if (n != 1) {
        n = getSelection().countObjectsOfType(Raytracing::LuxProject::getClassTypeId());
        if (n != 1) {
            QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
                QObject::tr("Select one Raytracing project object."));
            return;
        }
        else {
            filterLabel =  QString::fromLatin1("%1 (*.lxs)").arg(QObject::tr("Luxrender"));
        }
    }
    else {
        filterLabel = QString::fromLatin1("%1 (*.pov)").arg(QObject::tr("POV-Ray"));
    }

    QStringList filter;
    filter << filterLabel;
    filter << QString::fromLatin1("%1 (*.*)").arg(QObject::tr("All Files"));

    QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QObject::tr("Export page"), QString(), filter.join(QLatin1String(";;")));
    if (!fn.isEmpty()) {
        std::vector<Gui::SelectionSingleton::SelObj> Sel = getSelection().getSelection();
        openCommand("Raytracing export project");

        doCommand(Doc,"PageFile = open(App.activeDocument().%s.PageResult,'r')",Sel[0].FeatName);
        std::string fname = (const char*)fn.toUtf8();
        doCommand(Doc,"OutFile = open(unicode('%s','utf-8'),'w')",fname.c_str());
        doCommand(Doc,"OutFile.write(PageFile.read())");
        doCommand(Doc,"del OutFile,PageFile");

        commitCommand();
    }
}
Exemplo n.º 18
0
void CHexViewView::showCaret() {
  if(!m_caretVisible) {
    CreateSolidCaret(2, CARETHEIGHT);
    ShowCaret();
    m_caretVisible = true;
  }
  m_caret.y = minMax(m_caret.y, 0, m_maxCaret.y);
  m_caret.x = minMax(m_caret.x, 0, m_maxCaret.x);

  bool redraw = false;
  if(m_lineCount && (m_lastLineSize < m_lineSize) && (m_topLine + m_caret.y == m_lineCount-1)) {
    if(m_lineOffset > m_maxLastLineOffset) {
      m_lineOffset = m_maxLastLineOffset;
      isNewSelection();
      redraw = true;
    } else {
      m_caret.x = minMax(m_caret.x, 0, m_lastLineSize - m_lineOffset);
      redraw = isNewSelection();
    }
  } else {
    redraw = isNewSelection();
  }
  m_lastCurrentAddr = getCurrentAddr();
  m_lastSelection   = getSelection();

  if(redraw) {
    repaint();
    return;
  }

  CPoint p(m_caret.x * m_byteSize.cx + m_contentRect.left + m_digitIndex*m_charSize.cx, m_caret.y * m_byteSize.cy + m_contentRect.top);
  SetCaretPos(p);
  m_keepSelection = false;
/*
  const String tmp = format(_T("%s bytes. Addr:%s. Lsize:%d[%d]. Lcount:%I64u, Psize(%d,%d), Scroll(%d,%I64u),max(%d,%I64u)[%d], Caret(%d,%d),max:(%d,%d), Anchor:%I64d, Mark:%s, %s")
                          ,format1000(m_docSize       ).cstr()
                          ,format1000(getCurrentAddr()).cstr()
                          ,m_lineSize, m_lastLineSize
                          ,m_lineCount
                          ,m_pageSize.cx, m_pageSize.cy
                          ,m_lineOffset , m_topLine      , m_maxLineOffset, m_maxTopLine, m_maxLastLineOffset
                          ,m_caret.x    , m_caret.y      , m_maxCaret.x   , m_maxCaret.y
                          ,m_anchor
                          ,getSelection().toString().cstr()
                          ,m_shift ? _T("shift") : EMPTYSTRING);

  theApp.GetMainWnd()->SetWindowText(tmp.cstr());
*/
}
Exemplo n.º 19
0
void CmdPartSection::activated(int iMsg)
{
    unsigned int n = getSelection().countObjectsOfType(Part::Feature::getClassTypeId());
    if (n != 2) {
        QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
            QObject::tr("Select two shapes please."));
        return;
    }

    std::vector<Gui::SelectionSingleton::SelObj> Sel = getSelection().getSelection();
    std::string FeatName = getUniqueObjectName("Section");
    std::string BaseName  = Sel[0].FeatName;
    std::string ToolName  = Sel[1].FeatName;

    openCommand("Section");
    doCommand(Doc,"App.activeDocument().addObject(\"Part::Section\",\"%s\")",FeatName.c_str());
    doCommand(Doc,"App.activeDocument().%s.Base = App.activeDocument().%s",FeatName.c_str(),BaseName.c_str());
    doCommand(Doc,"App.activeDocument().%s.Tool = App.activeDocument().%s",FeatName.c_str(),ToolName.c_str());
    doCommand(Gui,"Gui.activeDocument().hide('%s')",BaseName.c_str());
    doCommand(Gui,"Gui.activeDocument().hide('%s')",ToolName.c_str());
    doCommand(Gui,"Gui.activeDocument().%s.LineColor = Gui.activeDocument().%s.ShapeColor", FeatName.c_str(),BaseName.c_str());
    updateActive();
    commitCommand();
}
Exemplo n.º 20
0
bool RetrieveBuffer(std::string& text, std::string::size_type& pos)
{
  SDL_SysWMinfo info;

  //printf("Retrieving buffer...\n");
  SDL_VERSION(&info.version);
  if (SDL_GetWMInfo(&info)) {
    Display *dpy  = info.info.x11.display;
    Window  us    = info.info.x11.window;
    char    *data = NULL;

    if (!data) {
      data = getSelection(dpy, us, XA_PRIMARY);
    }
    if (!data) {
      data = getSelection(dpy, us, XA_SECONDARY);
    }
    if (!data) {
      Atom XA_CLIPBOARD = XInternAtom(dpy, "CLIPBOARD", 0);
      data = getSelection(dpy, us, XA_CLIPBOARD);
    }
    if (data) {
      // check cursor position
      if (pos > text.size()) {
        pos = text.size();
      }

      text.insert(pos, data);
      pos += strlen(data);
      XFree(data);

      return true;
    }
  }
  return false;
}
Exemplo n.º 21
0
void* IEView::getSelection(IEVIEWEVENT *event) {
    if (selectedText!=NULL) delete selectedText;
    selectedText = getSelection();
    if (selectedText == NULL || wcslen(selectedText)== 0) return NULL;
    if (event->dwFlags & IEEF_NO_UNICODE) {
        int cp = CP_ACP;
        if (event->cbSize == sizeof(IEVIEWEVENT)) {
            cp = event->codepage;
        }
        char *str = Utils::convertToString(selectedText, cp);
        delete selectedText;
        selectedText = (BSTR) str;
    }
    return (void *)selectedText;
}
Exemplo n.º 22
0
void SciDoc::duplicateText() {
	if ( int_->curEdit_ == NULL ) return;

	int_->curEdit_->beginUndoAction();
	if ( int_->curEdit_->hasSelectedText() ) {
		int col1, row1, col2, row2;
		getSelection(col1, row1, col2, row2);
		int_->curEdit_->SendScintilla(QsciScintilla::SCI_SELECTIONDUPLICATE);
		setSelection(col1, row1, col2, row2);
	}
	else {
		int_->curEdit_->SendScintilla(QsciScintilla::SCI_LINEDUPLICATE);
	}
	int_->curEdit_->endUndoAction();
}
STDMETHODIMP CCommands::CodeRoverBrowseMethod() {
	AFX_MANAGE_STATE(AfxGetStaticModuleState())
    CComBSTR file;
    CComBSTR token;
    long line;
    long column;
	long offset;
    getSelection(file,token,offset,line,column);
	CString eventStr;
	CString fileName;
	fileName=file.m_str;
    eventStr.Format("query\t%s\t%d\t%d\t%d\n",fileName,offset,line,column);

    connections->sendEvent(eventStr);
	return S_OK;
}
Exemplo n.º 24
0
void IntPropChioce::outputData()
{
	if ( !mData )
		return;

	int pos = getSelection();
	if ( pos == -1 )
		return;

	int  value = (int)getItemData( pos );
	switch( mDataSize )
	{
	case 1: *((int8*)mData)  = value; break;
	case 2: *((int16*)mData) = value; break;
	case 4: *((int32*)mData)   = value; break;
	}
}
Exemplo n.º 25
0
/*!
  If there is selected text, sets \a line1, \a col1, \a line2 and \a col2
  to the start and end of the selected region and returns TRUE. Returns
  FALSE if there is no selected text.
 */
bool QMultiLineEdit::getMarkedRegion( int *line1, int *col1,
				      int *line2, int *col2 ) const
{
    int p1,c1, p2, c2;
    getSelection( &p1, &c1, &p2, &c2 );
    if ( p1 == -1 && c1 == -1 && p2 == -1 && c2 == -1 )
	return FALSE;
    if ( line1 )
	*line1 = p1;
    if ( col1 )
	*col1 = c1;
    if ( line2 )
	*line2 = p2;
    if ( col2 )
	*col2 = c2;
    return TRUE;
}
Exemplo n.º 26
0
bool CHexViewView::isNewSelection() {
  if(m_keepSelection) {
    return false;
  }
  if(m_shift) {
    if(!hasAnchor()) {
      dropAnchor(m_lastCurrentAddr);
      return true;
    }
  } else { // !m_shift
    if(hasAnchor()) {
      resetAnchor();
      return true;
    }
  }
  return getSelection() != m_lastSelection;
}
	// 激活插件
	void TerrainEditorPlugin::activate()
	{
		if(m_activated)
			return;
		m_worldEditor->getMainFrame()->getDockingPaneManager()->ShowPane(DlgTerrainBrush::IDD);
		m_worldEditor->getMainFrame()->getDockingPaneManager()->ShowPane(DlgTerrainHeight::IDD);
		m_worldEditor->getMainFrame()->getDockingPaneManager()->ShowPane(DlgTerrainPaint::IDD);
		m_worldEditor->getMainFrame()->addChildViewListener(this);

		setTerrainAction(new SelectTerrainAction(getActivatedTerrain()
			, getSelectionRenderer()
			, getSelection() 
			, getTerrainBrush()
			));

		m_activated = true;

	}
Exemplo n.º 28
0
void* IEView::getSelection(IEVIEWEVENT *event)
{
	mir_free(selectedText);
	selectedText = getSelection();
	if (mir_wstrlen(selectedText) == 0)
		return NULL;

	if (event->dwFlags & IEEF_NO_UNICODE) {
		int cp = CP_ACP;
		if (event->cbSize >= IEVIEWEVENT_SIZE_V2)
			cp = event->codepage;

		char *str = mir_t2a_cp(selectedText, cp);
		mir_free(selectedText);
		selectedText = (BSTR)str;
	}
	return (void*)selectedText;
}
Exemplo n.º 29
0
void XournalView::repaintSelection(bool evenWithoutSelection)
{
	XOJ_CHECK_TYPE(XournalView);

	if (evenWithoutSelection)
	{
		gtk_widget_queue_draw(this->widget);
		return;
	}

	EditSelection* selection = getSelection();
	if (selection == NULL)
	{
		return;
	}

	// repaint always the whole widget
	gtk_widget_queue_draw(this->widget);
}
Exemplo n.º 30
0
void SimTreeView::checkMenu( HMENU hMenu )
{
   UINT  flag;
   
   if ( getSelection() )
      flag = MF_ENABLED;
   else
      flag = MF_GRAYED;

   EnableMenuItem( hMenu, IDM_CUT, flag );
   EnableMenuItem( hMenu, IDM_COPY, flag );
   EnableMenuItem( hMenu, IDM_DELETE, flag );
   EnableMenuItem( hMenu, IDM_REMOVE, flag );
   EnableMenuItem( hMenu, IDM_DUPLICATE, flag );
   EnableMenuItem( hMenu, IDM_EDIT, flag );

   // seperate check to see if clip.tmp exists
   EnableMenuItem( hMenu, IDM_PASTE, flag );
}