DatabaseViewComponent::DatabaseViewComponent(GuiContainer* owner)
: GuiElement(owner, "DATABASE_VIEW")
{
    database_entry = nullptr;

    item_list = new GuiListbox(this, "DATABASE_ITEM_LIST", [this](int index, string value) {
        P<ScienceDatabase> entry;
        if (selected_entry)
        {
            if (index == 0)
            {
                selected_entry = selected_entry->parent;
                fillListBox();
            }else{
                entry = selected_entry->items[index - 1];
            }
        }
        else
        {
            entry = ScienceDatabase::science_databases[index];
        }
        display(entry);
    });
    item_list->setPosition(0, 0, ATopLeft)->setMargins(20, 20, 20, 130)->setSize(400, GuiElement::GuiSizeMax);
    fillListBox();
}
void ClassAssociationsPage::slotMenuSelection(QAction* action)
{
    int currentItemIndex = m_pAssocLW->currentRow();
    if (currentItemIndex == -1) {
        return;
    }
    AssociationWidget * a = m_List.at(currentItemIndex);
    ListPopupMenu::MenuType id = ListPopupMenu::typeFromAction(action);
    switch (id) {
    case ListPopupMenu::mt_Delete:
        m_pScene->removeAssocInViewAndDoc(a);
        fillListBox();
        break;

    case ListPopupMenu::mt_Line_Color:
        //:TODO:
        uDebug() << "MenuType mt_Line_Color not yet implemented!";
        break;

    case ListPopupMenu::mt_Properties:
        slotDoubleClick(m_pAssocLW->currentItem());
        break;

    default:
        uDebug() << "MenuType " << ListPopupMenu::toString(id) << " not implemented";
    }
}
/**
 *  Constructs an instance of AssocPage.
 *
 *  @param  parent  The parent of the page
 *  @param  s       The scene on which the UMLObject is being represented
 *  @param  o       The UMLObject being represented
 */
ClassAssociationsPage::ClassAssociationsPage(QWidget *parent, UMLScene *s, UMLObject *o)
  : DialogPageBase(parent),
    m_pObject(o),
    m_pScene(s)
{
    int margin = fontMetrics().height();

    QHBoxLayout * mainLayout = new QHBoxLayout(this);
    mainLayout->setSpacing(10);

    m_pAssocGB = new QGroupBox(i18n("Associations"), this);
    mainLayout->addWidget(m_pAssocGB);

    QHBoxLayout * layout = new QHBoxLayout(m_pAssocGB);
    layout->setSpacing(10);
    layout->setMargin(margin);

    m_pAssocLW = new QListWidget(m_pAssocGB);
    m_pAssocLW->setContextMenuPolicy(Qt::CustomContextMenu);
    layout->addWidget(m_pAssocLW);
    setMinimumSize(310, 330);
    fillListBox();

    connect(m_pAssocLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(slotDoubleClick(QListWidgetItem*)));
    connect(m_pAssocLW, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(slotRightButtonPressed(QPoint)));
}
Beispiel #4
0
void AssocTab::slotPopupMenuSel(QAction* action)
{
    int currentItemIndex = m_pAssocTW->currentRow();
    if ( currentItemIndex == -1 ) {
        return;
    }
    AssociationWidget * a = m_List.at(currentItemIndex);
    ListPopupMenu::Menu_Type id = m_pMenu->getMenuType(action);
    switch (id) {
    case ListPopupMenu::mt_Delete:
        m_pView->removeAssocInViewAndDoc(a);
        fillListBox();
        break;

    case ListPopupMenu::mt_Line_Color:
        //:TODO:
        uDebug() << "Menu_Type mt_Line_Color not yet implemented!";
        break;

    case ListPopupMenu::mt_Properties:
        slotDoubleClick(m_pAssocTW->currentItem());
        break;

    default:
        uDebug() << "Menu_Type " << id << " not implemented";
    }
}
Beispiel #5
0
static void onInitDialog(HWND hWnd, LPSTR lpsz) 
{
  hWndDirPicker = hWnd;
  lpszStringToReturn = lpsz;
  
  hIconDrives[0] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVEFLOPPY));
  hIconDrives[1] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVEHARD));
  hIconDrives[2] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVENETWORK));
  hIconDrives[3] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVECDROM));
  hIconDrives[4] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVERAM));

  hIconFolders[0] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_FOLDERCLOSED));
  hIconFolders[1] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_FOLDEROPEN));
  hIconFolders[2] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_OPENSELECT));
  
  if(lpsz[0] == '\0') 
    _getcwd(lpsz, _MAX_PATH);
  else if(lpsz[lstrlen(lpsz) - 1] == ':')
    lstrcat(lpsz, "\\");

  int ret = _chdir(lpsz);
  if(ret == -1) 
  {
    char szText[_MAX_PATH + 80];
    sprintf(szText, "The specified directory %s\ncannot be found", lpsz);
    MessageBox(GetParent(hWnd), szText, "Choose Directory", MB_ICONEXCLAMATION|MB_OK);
    _getcwd(lpsz, _MAX_PATH);
  }
  if((lpsz[0] == '\\') && (lpsz[1] == '\\'))
    fillUNCRootArray(lpsz);
  fillListBox(hWnd, lpsz);
  fillComboBox(hWnd);
}
Beispiel #6
0
void AssocTab::setObject(UMLObject * o, UMLView * v)
{
  if (m_pObject != o) {
    m_pObject = o;
    m_pView = v;
    fillListBox();
  }
}
void dlgNewVSCPSession::OnInitDialog(wxInitDialogEvent& event)
{
    ////@begin wxEVT_INIT_DIALOG event handler for ID_DIALOG_NEW_VSCP_SESSION in DlgNewVSCPSession.
    // Before editing this code, remove the block markers.
    event.Skip();
    ////@end wxEVT_INIT_DIALOG event handler for ID_DIALOG_NEW_VSCP_SESSION in DlgNewVSCPSession. 

    fillListBox(wxString(_("")));
}
Beispiel #8
0
/**
 *  Show the screen.
 *  If it is called from WebScreen it does not need refresh,
 *  but if from TitleScreen the list box needs refresh.
 */
void SummaryScreen::showScreen(bool needsRefresh) {

	// Each time this screen is shown, refresh the list taken from the engine.
	if ( needsRefresh ){
		fillListBox();
	}

	// Display the current screen.
	BasicScreen::showScreen();
}
Beispiel #9
0
void dlgNewVSCPSession::OnButtonRemoveClick(wxCommandEvent& event)
{
    int selidx = -1;
    if (wxNOT_FOUND != (selidx = m_ctrlListInterfaces->GetSelection())) {

        if ((0 == selidx) && m_bShowUnconnectedMode) {
            wxMessageBox(_("Can't remove this line."));
        } 
        else {
            if (wxYES == wxMessageBox(_("Do you really want to remove interface?"),
                    _("Confirm"),
                    wxYES_NO | wxCANCEL)) {
                both_interface *pBoth = 
                    (both_interface *) m_ctrlListInterfaces->GetClientData(selidx);
                if (NULL != pBoth) {
                    if ((INTERFACE_CANAL == pBoth->m_type) && (NULL != pBoth->m_pcanalif)) {
                        if (g_Config.m_canalIfList.DeleteObject(pBoth->m_pcanalif)) {
                            delete pBoth->m_pcanalif;
                            fillListBox(wxString(_("")));
                            ::wxGetApp().writeConfiguration();
                        }
                    } 
                    else if ( ( INTERFACE_VSCP == pBoth->m_type ) && 
                                ( NULL != pBoth->m_pvscpif ) ) {
                        if (g_Config.m_vscpIfList.DeleteObject(pBoth->m_pvscpif)) {
                            delete pBoth->m_pvscpif;
                            fillListBox(wxString(_("")));
                            ::wxGetApp().writeConfiguration();
                        }
                    }
                }
            }
        }
    }
    else {
        wxMessageBox(_("You need to select one interface to remove before this operation can be performed."),
                _("Remove interface"),
                wxICON_INFORMATION);
    }

    event.Skip();
}
Beispiel #10
0
/**
 *  Show the screen.
 *  If it does not need refresh, it is called from the SummaryScreen.
 *  The list box need refresh when this is called from the home screen.
 */
void TitleScreen::showScreen(bool needsRefresh)
{
	if (needsRefresh)
	{
		// Each time a new search is initiated, refresh the check box list.
		// Data is taken from the engine.
		fillListBox();
	}

	// Display the current screen.
	BasicScreen::showScreen();
}
Beispiel #11
0
static void rebuildIpsList()
{
	fillListBox();
	checkActivePatches();

	// parse ips relations
	if (parseRelations()) {
		hasAssist = FALSE;
	} else {
		hasAssist = TRUE;
	}
	EnableWindow(GetDlgItem(hIpsDlg, IDC_IPS_ENFORCE), hasAssist);
}
void ClassAssociationsPage::slotDoubleClick(QListWidgetItem * item)
{
    if (!item) {
        return;
    }

    int row = m_pAssocLW->currentRow();
    if (row == -1) {
        return;
    }

    AssociationWidget * a = m_List.at(row);
    a->showPropertiesDialog();
    fillListBox();
}
Beispiel #13
0
void AssocTab::slotDoubleClick(QTableWidgetItem * item)
{
    if (!item) {
        return;
    }

    int row = m_pAssocTW->currentRow();
    if ( row == -1 ) {
        return;
    }

    AssociationWidget * a = m_List.at(row);
    if (a->showDialog()) {
        fillListBox();
    }
}
void WizardEditor::applyClicked()
{
    if ( commands.isEmpty() ) return;

    // schedule macro command
    MacroCommand* cmd = new MacroCommand( tr( "Edit Wizard Pages" ), formwindow, commands );
    formwindow->commandHistory()->addCommand( cmd );
    cmd->execute();

    // clear command list
    commands.clear();

    // fix wizard buttons
    for ( int i = 0; i < wizard->pageCount(); i++ ) {

	QWidget * page = wizard->page( i );
	if ( i == 0 ) { // first page

	    wizard->setBackEnabled( page, FALSE );
	    wizard->setNextEnabled( page, TRUE );
	}
	else if ( i == wizard->pageCount() - 1 ) { // last page

	    wizard->setBackEnabled( page, TRUE );
	    wizard->setNextEnabled( page, FALSE );
	}
	else {

	    wizard->setBackEnabled( page, TRUE );
	    wizard->setNextEnabled( page, TRUE );
	}
	wizard->setFinishEnabled( page, FALSE );
    }

    // update listbox
    int index = listBox->currentItem();
    fillListBox();
    listBox->setCurrentItem( index );

    // show current page
    wizard->showPage( wizard->page( 0 ) );
}
WizardEditor::WizardEditor( QWidget *parent, QWizard *w, FormWindow *fw )
    : WizardEditorBase( parent, 0 ), formwindow( fw ), wizard( w ), draggedItem( 0 )
{
    connect( buttonHelp, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) );
    fillListBox();

    // Add drag and drop
    ListBoxDnd *listBoxDnd = new ListBoxDnd( listBox );
    listBoxDnd->setDragMode( ListBoxDnd::Internal | ListBoxDnd::Move );
    QObject::connect( listBoxDnd, SIGNAL( dropped( QListBoxItem * ) ),
		      listBoxDnd, SLOT( confirmDrop( QListBoxItem * ) ) );

    QObject::connect( listBoxDnd, SIGNAL( dragged( QListBoxItem * ) ),
		      this, SLOT( itemDragged( QListBoxItem * ) ) );
    QObject::connect( listBoxDnd, SIGNAL( dropped( QListBoxItem * ) ),
		      this, SLOT( itemDropped( QListBoxItem * ) ) );

    // Add in-place rename
    new ListBoxRename( listBox );
}
Beispiel #16
0
void HelpDialogCallBack( a_dialog *info )
{
    char                buf[_MAX_PATH];
    unsigned            len;

    if( info != curHelpDialog ) return;
    if( info->curr == editVField ) {
        if( info->edit_data->edit_eline.dirty ) {
            curHelpDialog->edit_data->edit_eline.dirty = FALSE;
            len = min( editCtl.length, sizeof( buf ) );
            strncpy( buf, editCtl.buffer, len );
            buf[ len ] = '\0';
            len--;
            while( len > 0 && isspace( buf[len] ) ) {
                buf[len] = '\0';
                len--;
            }
            fillListBox( buf );
        }
    }
}
//! constructor
CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title,
		IGUIEnvironment* environment, IGUIElement* parent, s32 id,
		bool restoreCWD, io::path::char_type* startDir)
: IGUIFileOpenDialog(environment, parent, id,
		core::rect<s32>((parent->getAbsolutePosition().getWidth()-FOD_WIDTH)/2,
					(parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2,
					(parent->getAbsolutePosition().getWidth()-FOD_WIDTH)/2+FOD_WIDTH,
					(parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2+FOD_HEIGHT)),
	FileNameText(0), FileList(0), Dragging(false)
{
	#ifdef _DEBUG
	IGUIElement::setDebugName("CGUIFileOpenDialog");
	#endif

	Text = title;

	FileSystem = Environment?Environment->getFileSystem():0;

	if (FileSystem)
	{
		FileSystem->grab();

		if (restoreCWD)
			RestoreDirectory = FileSystem->getWorkingDirectory();
		if (startDir)
		{
			StartDirectory = startDir;
			FileSystem->changeWorkingDirectoryTo(startDir);
		}
	}
	else
		return;

	IGUISpriteBank* sprites = 0;
	video::SColor color(255,255,255,255);
	IGUISkin* skin = Environment->getSkin();
	if (skin)
	{
		sprites = skin->getSpriteBank();
		color = skin->getColor(EGDC_WINDOW_SYMBOL);
	}

	const s32 buttonw = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
	const s32 posx = RelativeRect.getWidth() - buttonw - 4;

	CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
		L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close");
	CloseButton->setSubElement(true);
	CloseButton->setTabStop(false);
	if (sprites)
	{
		CloseButton->setSpriteBank(sprites);
		CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), color);
		CloseButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_CLOSE), color);
	}
	CloseButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
	CloseButton->grab();

	OKButton = Environment->addButton(
		core::rect<s32>(RelativeRect.getWidth()-80, 30, RelativeRect.getWidth()-10, 50),
		this, -1, skin ? skin->getDefaultText(EGDT_MSG_BOX_OK) : L"OK");
	OKButton->setSubElement(true);
	OKButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
	OKButton->grab();

	CancelButton = Environment->addButton(
		core::rect<s32>(RelativeRect.getWidth()-80, 55, RelativeRect.getWidth()-10, 75),
		this, -1, skin ? skin->getDefaultText(EGDT_MSG_BOX_CANCEL) : L"Cancel");
	CancelButton->setSubElement(true);
	CancelButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
	CancelButton->grab();

	FileBox = Environment->addListBox(core::rect<s32>(10, 55, RelativeRect.getWidth()-90, 230), this, -1, true);
	FileBox->setSubElement(true);
	FileBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
	FileBox->grab();

	FileNameText = Environment->addEditBox(0, core::rect<s32>(10, 30, RelativeRect.getWidth()-90, 50), true, this);
	FileNameText->setSubElement(true);
	FileNameText->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
	FileNameText->grab();

	setTabGroup(true);

	fillListBox();
}
//! called if an event happened.
bool CGUIFileOpenDialog::OnEvent(const SEvent& event)
{
	if (isEnabled())
	{
		switch(event.EventType)
		{
		case EET_GUI_EVENT:
			switch(event.GUIEvent.EventType)
			{
			case EGET_ELEMENT_FOCUS_LOST:
				Dragging = false;
				break;
			case EGET_BUTTON_CLICKED:
				if (event.GUIEvent.Caller == CloseButton ||
					event.GUIEvent.Caller == CancelButton)
				{
					sendCancelEvent();
					remove();
					return true;
				}
				else
				if (event.GUIEvent.Caller == OKButton )
				{
					if ( FileDirectory != L"" )
					{
						sendSelectedEvent( EGET_DIRECTORY_SELECTED );
					}
					if ( FileName != L"" )
					{
						sendSelectedEvent( EGET_FILE_SELECTED );
						remove();
						return true;
					}
				}
				break;

			case EGET_LISTBOX_CHANGED:
				{
					s32 selected = FileBox->getSelected();
					if (FileList && FileSystem)
					{
						if (FileList->isDirectory(selected))
						{
							FileName = L"";
							FileDirectory = FileList->getFullFileName(selected);
						}
						else
						{
							FileDirectory = L"";
							FileName = FileList->getFullFileName(selected);
						}
						return true;
					}
				}
				break;

			case EGET_LISTBOX_SELECTED_AGAIN:
				{
					const s32 selected = FileBox->getSelected();
					if (FileList && FileSystem)
					{
						if (FileList->isDirectory(selected))
						{
							FileDirectory = FileList->getFullFileName(selected);
							FileSystem->changeWorkingDirectoryTo(FileList->getFileName(selected));
							fillListBox();
							FileName = "";
						}
						else
						{
							FileName = FileList->getFullFileName(selected);
						}
						return true;
					}
				}
				break;
			case EGET_EDITBOX_ENTER:
				if (event.GUIEvent.Caller == FileNameText)
				{
					io::path dir( FileNameText->getText () );
					if ( FileSystem->changeWorkingDirectoryTo( dir ) )
					{
						fillListBox();
						FileName = L"";
					}
					return true;
				}
			break;
			default:
				break;
			}
			break;
		case EET_MOUSE_INPUT_EVENT:
			switch(event.MouseInput.Event)
			{
			case EMIE_MOUSE_WHEEL:
				return FileBox->OnEvent(event);
			case EMIE_LMOUSE_PRESSED_DOWN:
				DragStart.X = event.MouseInput.X;
				DragStart.Y = event.MouseInput.Y;
				Dragging = true;
				return true;
			case EMIE_LMOUSE_LEFT_UP:
				Dragging = false;
				return true;
			case EMIE_MOUSE_MOVED:

				if ( !event.MouseInput.isLeftPressed () )
					Dragging = false;

				if (Dragging)
				{
					// gui window should not be dragged outside its parent
					if (Parent)
						if (event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 ||
							event.MouseInput.Y < Parent->getAbsolutePosition().UpperLeftCorner.Y +1 ||
							event.MouseInput.X > Parent->getAbsolutePosition().LowerRightCorner.X -1 ||
							event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1)

							return true;

					move(core::position2d<s32>(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y));
					DragStart.X = event.MouseInput.X;
					DragStart.Y = event.MouseInput.Y;
					return true;
				}
				break;
			default:
				break;
			}
		default:
			break;
		}
	}

	return IGUIElement::OnEvent(event);
}
Beispiel #19
0
void dlgNewVSCPSession::OnButtonCloneClick(wxCommandEvent& event)
{
    int selidx = -1;

    if (wxNOT_FOUND != (selidx = m_ctrlListInterfaces->GetSelection())) {

        if ((0 == selidx) && m_bShowUnconnectedMode) {
            wxMessageBox(_("Can't edit this line."));
        } 
        else {

            both_interface *pBoth = 
                (both_interface *) m_ctrlListInterfaces->GetClientData(selidx);
            if (NULL != pBoth) {

                if (INTERFACE_CANAL == pBoth->m_type) {

                    // A new CANAL driver
                    canal_interface *pInfo = new canal_interface;
                    if (NULL != pInfo) {
                        pInfo->m_strDescription = wxGetTextFromUser(_("Enter new description"));
                        pInfo->m_strPath = pBoth->m_pcanalif->m_strPath;
                        pInfo->m_strConfig = pBoth->m_pcanalif->m_strConfig;
                        pInfo->m_flags = pBoth->m_pcanalif->m_flags;
                        g_Config.m_canalIfList.Append(pInfo);
                    }

                } 
                else if (INTERFACE_VSCP == pBoth->m_type) {

                    // A new remote host
                    vscp_interface *pInfo = new vscp_interface;
                    if (NULL != pInfo) {
                        pInfo->m_strDescription = wxGetTextFromUser(_("Enter description"));
                        pInfo->m_strHost = pBoth->m_pvscpif->m_strHost;
                        pInfo->m_strUser = pBoth->m_pvscpif->m_strUser;
                        pInfo->m_strPassword = pBoth->m_pvscpif->m_strPassword;
                        pInfo->m_strInterfaceName = pBoth->m_pvscpif->m_strInterfaceName;
                        pInfo->m_bLevel2 = pBoth->m_pvscpif->m_bLevel2;
                        memcpy( &pInfo->m_vscpfilter, 
                                    &pBoth->m_pvscpif->m_vscpfilter, 
                                    sizeof( vscpEventFilter));
                        g_Config.m_vscpIfList.Append(pInfo);
                    }

                } 
                else {
                    wxMessageBox( _("Unknown interface type!"), 
                                    _("Edit Interface"), wxICON_STOP);
                    return;
                }

                // Write the configuration
                ::wxGetApp().writeConfiguration();

                fillListBox(wxString(_("")));

                m_ctrlListInterfaces->SetSelection(selidx);

            } 
            else {
                wxMessageBox( _("No data associated with listbox line"), 
                                _("Edit Interface"), wxICON_STOP);
            }
        } // 0 == selidx
    }
    else {
        wxMessageBox(_("You need to select one interface to edit before this operation can be performed."),
                _("Edit interface"),
                wxICON_INFORMATION);
    }
}
Beispiel #20
0
void dlgNewVSCPSession::OnButtonEditClick(wxCommandEvent& event)
{
    int selidx = -1;

    if (wxNOT_FOUND != (selidx = m_ctrlListInterfaces->GetSelection())) {

        if ((0 == selidx) && m_bShowUnconnectedMode) {
            wxMessageBox(_("Can't edit this line."));
        } 
        else {

            both_interface *pBoth = (both_interface *) m_ctrlListInterfaces->GetClientData(selidx);
            if (NULL != pBoth) {

                dlgVscpInterfaceSettings dlg(this);

                if (INTERFACE_CANAL == pBoth->m_type) {

                    dlg.SetTitle(_("Edit VSCP interface"));
                    dlg.m_DriverDescription->SetValue(pBoth->m_pcanalif->m_strDescription);
                    dlg.m_PathToDriver->SetValue(pBoth->m_pcanalif->m_strPath);
                    dlg.m_DriverConfigurationString->SetValue(pBoth->m_pcanalif->m_strConfig);
                    dlg.m_DriverFlags->SetValue(wxString::Format(_("%lu"), pBoth->m_pcanalif->m_flags));
                    dlg.GetBookCtrl()->SetSelection(0);
                    dlg.GetBookCtrl()->RemovePage(1);

                } 
                else if (INTERFACE_VSCP == pBoth->m_type) {

                    dlg.m_RemoteServerDescription->SetValue(pBoth->m_pvscpif->m_strDescription);
                    dlg.m_RemoteServerURL->SetValue(pBoth->m_pvscpif->m_strHost);
                    dlg.m_RemoteServerUsername->SetValue(pBoth->m_pvscpif->m_strUser);
                    dlg.m_RemoteServerPassword->SetValue(pBoth->m_pvscpif->m_strPassword);
                    dlg.m_RemoteInterfaceName->SetValue(pBoth->m_pvscpif->m_strInterfaceName);
                    memcpy(&dlg.m_vscpfilter, &pBoth->m_pvscpif->m_vscpfilter, sizeof( vscpEventFilter));

                    dlg.GetBookCtrl()->SetSelection(1);
                    dlg.GetBookCtrl()->RemovePage(0);
                } 
                else {
                    wxMessageBox(_("Unknown interface type!"), _("Edit Interface"), wxICON_STOP);
                    return;
                }

                // Show the dialog
                if (wxID_OK == dlg.ShowModal()) {

                    if (INTERFACE_CANAL == pBoth->m_type) {

                        pBoth->m_pcanalif->m_strDescription = dlg.m_DriverDescription->GetValue();
                        pBoth->m_pcanalif->m_strPath = dlg.m_PathToDriver->GetValue();
                        pBoth->m_pcanalif->m_strConfig = dlg.m_DriverConfigurationString->GetValue();
                        dlg.m_DriverFlags->GetValue().ToULong(&pBoth->m_pcanalif->m_flags);

                    } 
                    else if (INTERFACE_VSCP == pBoth->m_type) {

                        pBoth->m_pvscpif->m_strDescription = dlg.m_RemoteServerDescription->GetValue();
                        pBoth->m_pvscpif->m_strHost = dlg.m_RemoteServerURL->GetValue();
                        pBoth->m_pvscpif->m_strUser = dlg.m_RemoteServerUsername->GetValue();
                        pBoth->m_pvscpif->m_strPassword = dlg.m_RemoteServerPassword->GetValue();
                        pBoth->m_pvscpif->m_strInterfaceName = dlg.m_RemoteInterfaceName->GetValue();
                        pBoth->m_pvscpif->m_bLevel2 = dlg.m_fullLevel2->GetValue();

                        memcpy(&pBoth->m_pvscpif->m_vscpfilter, &dlg.m_vscpfilter, sizeof( vscpEventFilter));

                    }

                    // Write the configuration
                    ::wxGetApp().writeConfiguration();

                    fillListBox(wxString(_("")));

                    m_ctrlListInterfaces->SetSelection(selidx);
                }
            } 
            else {
                wxMessageBox(_("No data associated with listbox line"), _("Edit Interface"), wxICON_STOP);
            }
        } // 0 == selidx
    }
    else {
        wxMessageBox(_("You need to select one interface to edit before this operation can be performed."),
                _("Edit interface"),
                wxICON_INFORMATION);
    }

    event.Skip();
}
Beispiel #21
0
void dlgNewVSCPSession::OnButtonAddClick(wxCommandEvent& event)
{
    wxString strDecription;
    dlgVscpInterfaceSettings dlg(this);
    dlg.SetTitle(_("Add new VSCP/CANAL interface"));

    if (wxID_OK == dlg.ShowModal()) {

        // We add the driver to the structure
        if (dlg.m_DriverDescription->GetValue().Length()) {

            // A new CANAL driver
            canal_interface *pInfo = new canal_interface;
            if (NULL != pInfo) {
                strDecription = pInfo->m_strDescription = dlg.m_DriverDescription->GetValue();
                pInfo->m_strPath = dlg.m_PathToDriver->GetValue();
                pInfo->m_strConfig = dlg.m_DriverConfigurationString->GetValue();
                dlg.m_DriverFlags->GetValue().ToULong(&pInfo->m_flags);
                g_Config.m_canalIfList.Append(pInfo);

                // Write the configuration
                ::wxGetApp().writeConfiguration();

            }
        } 
        else if (dlg.m_RemoteServerDescription->GetValue().Length()) {

            // A new remote host
            vscp_interface *pInfo = new vscp_interface;
            if (NULL != pInfo) {

                strDecription = pInfo->m_strDescription = dlg.m_RemoteServerDescription->GetValue();

                pInfo->m_strHost = dlg.m_RemoteServerURL->GetValue();
                pInfo->m_strHost.Trim(false);
                pInfo->m_strHost.Trim();
                pInfo->m_strUser = dlg.m_RemoteServerUsername->GetValue();
                pInfo->m_strUser.Trim(false);
                pInfo->m_strUser.Trim();
                pInfo->m_strPassword = dlg.m_RemoteServerPassword->GetValue();
                pInfo->m_strPassword.Trim(false);
                pInfo->m_strPassword.Trim();
                pInfo->m_bLevel2 = dlg.m_fullLevel2->GetValue();
                wxString str;

                // Interface name
                pInfo->m_strInterfaceName = dlg.m_RemoteInterfaceName->GetValue();

                // Filter
                memcpy(&pInfo->m_vscpfilter, &dlg.m_vscpfilter, sizeof( vscpEventFilter));

                g_Config.m_vscpIfList.Append(pInfo);

                // Write the configuration
                ::wxGetApp().writeConfiguration();

            }
        } else {
            wxMessageBox(_("No driver added as a needed description is not found."));
        }

        fillListBox(strDecription);


    }
    event.Skip();
}
Beispiel #22
0
void dlgNewVSCPSession::OnInitDialog(wxInitDialogEvent& event)
{
    event.Skip();

    fillListBox( wxString(_("") ) );
}
//! called if an event happened.
bool CGUIFileOpenDialog::OnEvent(SEvent event)
{
	switch(event.EventType)
	{
	case EET_GUI_EVENT:
		switch(event.GUIEvent.EventType)
		{
		case EGET_ELEMENT_FOCUS_LOST:
			Dragging = false;
			break;
		case EGET_BUTTON_CLICKED:
			if (event.GUIEvent.Caller == CloseButton ||
				event.GUIEvent.Caller == CancelButton)
			{
				sendCancelEvent();
				remove();
				return true;
			}
			else
			if (event.GUIEvent.Caller == OKButton && FileName != L"")
			{
				sendSelectedEvent();
				remove();
				return true;
			}
			break;

		case EGET_LISTBOX_CHANGED:
			{
				s32 selected = FileBox->getSelected();
				if (FileList && FileSystem)
				{
					if (FileList->isDirectory(selected))
						FileName = L"";
					else
						FileName = FileList->getFullFileName(selected);
				}
			}
			break;

		case EGET_LISTBOX_SELECTED_AGAIN:
			{
				s32 selected = FileBox->getSelected();
				if (FileList && FileSystem)
				{
					if (FileList->isDirectory(selected))
					{
						FileSystem->changeWorkingDirectoryTo(FileList->getFileName(selected));
						fillListBox();
						FileName = L"";
					}
					else
					{
						FileName = FileList->getFullFileName(selected);
						return true;
					}
				}
			}
			break;
		}
		break;
	case EET_MOUSE_INPUT_EVENT:
		switch(event.MouseInput.Event)
		{
		case EMIE_LMOUSE_PRESSED_DOWN:
			DragStart.X = event.MouseInput.X;
			DragStart.Y = event.MouseInput.Y;
			Dragging = true;
			Environment->setFocus(this);
			return true;
		case EMIE_LMOUSE_LEFT_UP:
			Dragging = false;
			Environment->removeFocus(this);
			return true;
		case EMIE_MOUSE_MOVED:
			if (Dragging)
			{
				// gui window should not be dragged outside its parent
				if (Parent)
					if (event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 ||
						event.MouseInput.Y < Parent->getAbsolutePosition().UpperLeftCorner.Y +1 ||
						event.MouseInput.X > Parent->getAbsolutePosition().LowerRightCorner.X -1 ||
						event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1)

						return true;

				move(core::position2d<s32>(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y));
				DragStart.X = event.MouseInput.X;
				DragStart.Y = event.MouseInput.Y;
				return true;
			}
			break;
		}
	}

	return Parent ? Parent->OnEvent(event) : false;
}
Beispiel #24
0
//! constructor
CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title,
                                       IGUIEnvironment* environment, IGUIElement* parent, s32 id)
    : IGUIFileOpenDialog(environment, parent, id,
                         core::rect<s32>((parent->getAbsolutePosition().getWidth()-FOD_WIDTH)/2,
                                         (parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2,
                                         (parent->getAbsolutePosition().getWidth()-FOD_WIDTH)/2+FOD_WIDTH,
                                         (parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2+FOD_HEIGHT)),
      FileNameText(0), FileList(0), Dragging(false)
{
#ifdef _DEBUG
    IGUIElement::setDebugName("CGUIFileOpenDialog");
#endif

    Text = title;

    IGUISkin* skin = Environment->getSkin();
    IGUISpriteBank* sprites = 0;
    video::SColor color(255,255,255,255);
    if (skin)
    {
        sprites = skin->getSpriteBank();
        color = skin->getColor(EGDC_WINDOW_SYMBOL);
    }

    const s32 buttonw = environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH);
    const s32 posx = RelativeRect.getWidth() - buttonw - 4;

    CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
                                         L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close");
    CloseButton->setSubElement(true);
    CloseButton->setTabStop(false);
    if (sprites)
    {
        CloseButton->setSpriteBank(sprites);
        CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), color);
        CloseButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_CLOSE), color);
    }
    CloseButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
    CloseButton->grab();

    OKButton = Environment->addButton(
                   core::rect<s32>(RelativeRect.getWidth()-80, 30, RelativeRect.getWidth()-10, 50),
                   this, -1, skin ? skin->getDefaultText(EGDT_MSG_BOX_OK) : L"OK");
    OKButton->setSubElement(true);
    OKButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
    OKButton->grab();

    CancelButton = Environment->addButton(
                       core::rect<s32>(RelativeRect.getWidth()-80, 55, RelativeRect.getWidth()-10, 75),
                       this, -1, skin ? skin->getDefaultText(EGDT_MSG_BOX_CANCEL) : L"Cancel");
    CancelButton->setSubElement(true);
    CancelButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
    CancelButton->grab();

    FileBox = Environment->addListBox(core::rect<s32>(10, 55, RelativeRect.getWidth()-90, RelativeRect.getHeight() - 20), this, -1, true);
    FileBox->setSubElement(true);
    FileBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
    FileBox->grab();

    FileNameText = Environment->addEditBox(0, core::rect<s32>(10, 30, RelativeRect.getWidth()-90, 50), true, this);
    FileNameText->setSubElement(true);
    FileNameText->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
    FileNameText->grab();

    FileSystem = Environment->getFileSystem();

    if (FileSystem)
        FileSystem->grab();

    setTabGroup(true);

    fillListBox();

    //CGUIFileOpenDialog changes:

    // Careful, don't just set the modal as parent above. That will mess up the focus (and is hard to change because we have to be very
    // careful not to get virtual function call, like OnEvent, in the window.
    IGUIElement * modalScreen = Environment->addModalScreen(parent);
    modalScreen->addChild(this);

    initialWorkingDirectory = FileSystem->getWorkingDirectory();
}
void ToolsConfigWidget::updateListBoxes()
{
    fillListBox(toolsmenuBox, m_toolsmenuEntries);
    fillListBox(filecontextBox, m_filecontextEntries);
    fillListBox(dircontextBox, m_dircontextEntries);
}
Beispiel #26
0
char *HelpSearch( HelpHdl hdl )
{
    EVENT               event;
    char                done;
    char                *ret;

    static EVENT        events[] = {
        EV_NO_EVENT,
        EV_ENTER,
        EV_ESCAPE,
        EV_MOUSE_PRESS,
        EV_LIST_BOX_DCLICK,
        EV_NO_EVENT
    };

    searchHdl = hdl;
    listData = hdl->header.topiccnt;
    curHelpDialog = uibegdialog( "Search", helpSearchDialog, 12, 60, 0, 0 );
    if( editCtl.buffer == NULL ) {
        fillListBox( "" );
    } else {
        fillListBox( editCtl.buffer );
    }
    uipushlist( NULL );     /* modal barrier */
    uipushlist( events );
    done = 0;
    while( !done ) {
        event = uidialog( curHelpDialog );
        switch( event ) {
        case EV_MOUSE_PRESS:
            if( curHelpDialog->curr != NULL ) {
                if( curHelpDialog->curr->ptr == &listBox ) {
                    copyLBLinetoEditCtl( listBox.box->row );
                }
            }
            break;
        case EV_KILL_UI:
            uiforceevadd( EV_KILL_UI );
        /* fall through */
        case EV_ESCAPE:
            ret = NULL;
            done = 1;
            break;
        case EV_ENTER:
        case EV_LIST_BOX_DCLICK:
            ret = HelpMemAlloc( MAX_EDIT_LINE_LEN );
            GetLBItemLiteral( &listData, listBox.box->row, ret,
                              MAX_EDIT_LINE_LEN );
            if( ret[0] == '\0' ) {
                HelpMemFree( ret );
                ret = NULL;
            }
            done = 1;
            break;
        }
    }
    uipoplist();
    uipoplist();
    uienddialog( curHelpDialog );
    return( ret );
}
Beispiel #27
0
static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) 
{
  char szCurDir[_MAX_PATH];
  switch(id) 
  {
    case ID_LIST_DIR:
      if(codeNotify == LBN_DBLCLK) 
      {
        int index = ListBox_GetCurSel(hWndCtl);
        DWORD dwItemData = ListBox_GetItemData(hWndCtl, index);

        if(HIWORD(dwItemData) == ID_ICON_OPENSELECT) 
        {
          shutDialog(hWnd);
          char szString[_MAX_PATH];
          Edit_GetText(GetDlgItem(hWndDirPicker, ID_EDIT_DIR), szString, sizeof(szString));
          lstrcpy(lpszStringToReturn, szString);
          EndDialog(hWnd, IDOK);
          break;
        }

        ListBox_GetText(hWndCtl, index, szCurDir);

        char szDir[_MAX_DIR];
        LPSTR lpsz;
        if((HIWORD(dwItemData) == ID_ICON_FOLDEROPEN) && (index != 0)) 
        {
          GetWindowText(hWndCtl, szDir, sizeof(szDir));
          lpsz=_fstrstr(szDir, szCurDir);
          *(lpsz + lstrlen(szCurDir)) = '\0';
          lstrcpy(szCurDir, szDir);
        }
        if (_chdir(szCurDir) == 0) 
        {
          _getcwd(szCurDir, _MAX_PATH);
          fillListBox(hWndDirPicker, szCurDir);
        }
      }
      break;
    case ID_COMBO_DIR:
      if(codeNotify == CBN_SELCHANGE) 
      {
        char szDrive[80];
        int index = ComboBox_GetCurSel(hWndCtl);
        if(index == CB_ERR)
          break;
        ComboBox_GetLBText(hWndCtl, index, szDrive);

        int iCurDrive = _getdrive();
Retry:
        HCURSOR hCursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT));
        SetCapture(hWndDirPicker);
        if((0 == _chdrive((int)(szDrive[0] - 'a' + 1))) && (NULL != _getcwd(szCurDir, _MAX_PATH))) 
        {
          fillListBox(hWndDirPicker, szCurDir);
          ListBox_SetTopIndex(GetDlgItem(hWndDirPicker, ID_LIST_DIR), 0);
          SetCursor(hCursorOld);
          ReleaseCapture();
          break;
        }
        SetCursor(hCursorOld);
        ReleaseCapture();

        char szText[80];        
        sprintf(szText, "Cannot read drive %c:", szDrive[0]);
        if(IDRETRY == MessageBox(hWndDirPicker, szText, "Choose Directory", MB_ICONEXCLAMATION|MB_RETRYCANCEL))
          goto Retry;
        
        //Changing drives failed so restore drive and selection
        _chdrive(iCurDrive);

        sprintf(szDrive, "%c:", (char)(iCurDrive + 'a' - 1));
        index = ComboBox_SelectString(hWndCtl, -1, szDrive);
      }
      break;
    case IDOK:
      shutDialog(hWnd);
      char szString[_MAX_PATH];
      Edit_GetText(GetDlgItem(hWndDirPicker, ID_EDIT_DIR), szString, sizeof(szString));
      lstrcpy(lpszStringToReturn, szString);
      EndDialog(hWnd, IDOK);
      break;
    case IDCANCEL:
      shutDialog(hWnd);
      lpszStringToReturn[0] = '\0';
      EndDialog(hWnd, IDCANCEL);
      break;
    default:
      break;
  }
}