Ejemplo n.º 1
0
void QCSTreeWidget::contextMenuEvent(QContextMenuEvent *event)
{
	QMenu menu(this);
	if (QCSX_Settings.GetEdit())
	{
		QMenu* primM = menu.addMenu(QIcon(":/images/edit_add.png"),tr("New Primitive"));
		primM->addAction(tr("Box"),this,SIGNAL(NewBox()));
		primM->addAction(tr("Multi-Box"),this,SIGNAL(NewMultiBox()));
		primM->addAction(tr("Sphere"),this,SIGNAL(NewSphere()));
		primM->addAction(tr("Cylinder"),this,SIGNAL(NewCylinder()));
		primM->addAction(tr("User Defined"),this,SIGNAL(NewUserDefined()));

		QMenu* propM = menu.addMenu(QIcon(":/images/edit_add.png"),tr("New Property"));
		propM->addAction(tr("Material"),this,SIGNAL(NewMaterial()));
		propM->addAction(tr("Metal"),this,SIGNAL(NewMetal()));
		propM->addAction(tr("Excitation"),this,SIGNAL(NewExcitation()));
		propM->addAction(tr("Probe-Box"),this,SIGNAL(NewChargeBox()));
		propM->addAction(tr("Res-Box"),this,SIGNAL(NewResBox()));
		propM->addAction(tr("Dump-Box"),this,SIGNAL(NewDumpBox()));

		menu.addSeparator();

		menu.addAction(QIcon(":/images/edit.png"),tr("Edit"),this,SIGNAL(Edit()));
		menu.addAction(QIcon(":/images/editcopy.png"),tr("Copy"),this,SIGNAL(Copy()));
		menu.addAction(QIcon(":/images/edit_remove.png"),tr("Delete"),this,SIGNAL(Delete()));
	}
	else
	{
		menu.addAction(QIcon(":/images/edit.png"),tr("View"),this,SIGNAL(Edit()));
	}

	menu.exec(event->globalPos());
}
Ejemplo n.º 2
0
void Edit(treeNode* root, string wrd , string newWrd,  string mng, string des)
{
	if(root != NULL)
	{
		Edit(root->getLeft(),wrd,newWrd,mng,des);
		Edit(root->getRight(),wrd,newWrd,mng,des);
		if(wrd == root->getWord())
		{
     		// edit here
			root->setData(newWrd,mng,des);
		}
	}
}
Ejemplo n.º 3
0
// Constructor
EditorDialog::EditorDialog(QWidget *parent):
    QDialog(parent),
    _ui(new Ui::EditorDialog)
  #ifdef Q_OS_SYMBIAN
  , _addNewAction(new QAction(tr("Add new"), this)),
    _editAction(new QAction(tr("Edit"), this)),
    _removeAction(new QAction(tr("Remove"), this)),
    _loadAction(new QAction(tr("Load"), this)),
    _saveAction(new QAction(tr("Save"), this)),
    _menu(new QMenu(this)),
    _menuAction(new QAction(tr("Menu"), this)),
    _cancelAction(new QAction(tr("Cancel"), this))
  #endif // Q_OS_SYMBIAN
{
    _ui->setupUi(this);

    connect(_ui->messageList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(Edit()));
    connect(_ui->messageList, SIGNAL(currentRowChanged(int)), this, SLOT(SelectionChanged(int)));
#ifdef Q_OS_SYMBIAN
    _menu->addAction(_addNewAction);
    _menu->addAction(_editAction);
    _menu->addAction(_removeAction);
    _menu->addAction(_loadAction);
    _menu->addAction(_saveAction);

    addAction(_menuAction);
    addAction(_editAction);
    addAction(_cancelAction);

    _menuAction->setMenu(_menu);
    _menuAction->setSoftKeyRole(QAction::PositiveSoftKey);
    _editAction->setSoftKeyRole(QAction::SelectSoftKey);
    _cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);

    connect(_addNewAction, SIGNAL(triggered()), this, SLOT(AddNew()));
    connect(_editAction, SIGNAL(triggered()), this, SLOT(Edit()));
    connect(_removeAction, SIGNAL(triggered()), this, SLOT(Remove()));
    connect(_loadAction, SIGNAL(triggered()), this, SLOT(Load()));
    connect(_saveAction, SIGNAL(triggered()), this, SLOT(accept()));
    connect(_cancelAction, SIGNAL(triggered()), this, SLOT(reject()));
    connect(_ui->messageList, SIGNAL(entered(QModelIndex)), this, SLOT(Edit()));
#else
    connect(_ui->addNew, SIGNAL(clicked()), this, SLOT(AddNew()));
    connect(_ui->edit, SIGNAL(clicked()), this, SLOT(Edit()));
    connect(_ui->remove, SIGNAL(clicked()), this, SLOT(Edit()));
    connect(_ui->load, SIGNAL(clicked()), this, SLOT(Load()));
#endif // Q_OS_SYMBIAN
    SelectionChanged(_ui->messageList->currentRow());
}
Ejemplo n.º 4
0
void SavedRadio::ShowContextMenu(const QPoint& global_pos) {
  if (!context_menu_) {
    context_menu_ = new QMenu;
    context_menu_->addActions(GetPlaylistActions());
    remove_action_ = context_menu_->addAction(
        IconLoader::Load("list-remove", IconLoader::Base), tr("Remove"), 
        this, SLOT(Remove()));
    edit_action_ = context_menu_->addAction(IconLoader::Load("edit-rename", 
                                            IconLoader::Base), tr("Edit..."), 
                                            this, SLOT(Edit()));
    context_menu_->addSeparator();
    context_menu_->addAction(IconLoader::Load("document-open-remote", 
                             IconLoader::Base), tr("Add another stream..."), 
                             this, SIGNAL(ShowAddStreamDialog()));
  }

  const bool is_root =
      model()->current_index().data(InternetModel::Role_Type).toInt() ==
      InternetModel::Type_Service;

  GetAppendToPlaylistAction()->setEnabled(!is_root);
  GetReplacePlaylistAction()->setEnabled(!is_root);
  GetOpenInNewPlaylistAction()->setEnabled(!is_root);
  remove_action_->setEnabled(!is_root);
  edit_action_->setEnabled(!is_root);

  context_menu_->popup(global_pos);
}
Ejemplo n.º 5
0
//
// Edits an access spec when the user double clicks on it in the global list.
//
void CPageAccess::OnDblclkLGlobalAccess(NMHDR* pNMHDR, LRESULT* pResult) 
{
	Edit();
	m_LGlobalAccess.SetFocus();

	*pResult = 0;
}
Ejemplo n.º 6
0
//
// Create a new access spec object and add it to the gui.
//
void CPageAccess::OnBNew() 
{
	// Create a new access spec object and store the returned pointer.
	Test_Spec *spec;
	spec = theApp.access_spec_list.New();
	
	// Check for validity of returned index before adding anything to GUI.
	if ( !spec )
		return;

	// Clear any selection in the global list.
	int i = m_LGlobalAccess.GetNextItem( -1, LVIS_SELECTED );
	while ( i != NOTHING )
	{
		m_LGlobalAccess.SetItemState( i, NULL, LVIS_SELECTED );
		i = m_LGlobalAccess.GetNextItem( i, LVIS_SELECTED );
	}

	// Add the Access Spec to the global list view.
	// Set the data portion to the index of the access spec in the access spec
	// list. Select the newly added item.
	m_LGlobalAccess.InsertItem( LVIF_STATE | LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE,
		theApp.access_spec_list.IndexByRef( spec ), spec->name,
		LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED,
		AssignNone, (ULONG_PTR)spec );

	// Automatically call the edit function for the new spec.
	// Deletes the spec if editing was cancelled.
	if ( !Edit() )
		Delete();

	// Set the focus to the ListCtrl
	m_LGlobalAccess.SetFocus();
}
Ejemplo n.º 7
0
void CPageAccess::OnBEditCopy() 
{
	Test_Spec *spec;

	// Get the selected access spec's index into the global list.
	spec = (Test_Spec*)m_LGlobalAccess.GetItemData( 
		m_LGlobalAccess.GetNextItem( FIND_FIRST, LVNI_SELECTED ) );
	// Create the copy of the spec object.
	spec = theApp.access_spec_list.Copy( spec );
	
	// Check for validity of returned index before adding anything to GUI.
	if ( !spec )
		return;

	// Add the Access Spec to the global list view.
	// Set the data portion to the index of the access spec in the access spec list.
	// Select the newly added item and remove the selection from the previous
	// selected item.
	m_LGlobalAccess.SetItemState( m_LGlobalAccess.GetNextItem( FIND_FIRST, 
		LVNI_SELECTED ), NULL, LVIS_SELECTED );
	m_LGlobalAccess.InsertItem( LVIF_STATE | LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE,
		m_LGlobalAccess.GetItemCount(), spec->name,
		LVIS_SELECTED, LVIS_SELECTED, AssignNone, (ULONG_PTR)spec );						

	// Automatically call the edit function for the new spec.
	// Deletes the spec if editing was cancelled.
	if ( !Edit() )
		Delete();

	// Set the focus to the ListCtrl
	m_LGlobalAccess.SetFocus();
}
Ejemplo n.º 8
0
void QCSTreeWidget::Edit(QTreeWidgetItem * item, int column)
{
	UNUSED(column);
	if (item==NULL) return;
	if (item->type()!=PRIMTYPE) return;
	emit Edit();
}
Ejemplo n.º 9
0
void CAclWeb::OnDblclkAclList(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;

	if((m_iListIndex = pNMListView->iItem) != -1) 
		Edit();

	*pResult = 0;
}
Ejemplo n.º 10
0
void CMetadataTree::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	//CTreeCtrl *pCtrl=&GetTreeCtrl();
	//HTREEITEM CurItem=pCtrl->GetSelectedItem();
	//if(pCtrl->GetParentItem(CurItem))
	if(Edit())
		return;

	CTreeView::OnLButtonDblClk(nFlags, point);
}
Ejemplo n.º 11
0
		void elementStartHandler(const std::string & name, std::map<std::string,std::string> & attrs) {
			cur_buf.clear();
			if(name == "wpeditset") return;
			if(name == "wpedit") {
				current_edit = Edit();
				tag_stack.clear();
				return;
			}
			tag_stack.push_back(name);
		}
Ejemplo n.º 12
0
void
QuaSymbolBridge::MouseDown(BPoint where)
{
	long		channel, quant;
	BRect		area = Bounds();

	ulong		mods = modifiers(); // Key mods???
	ulong		buts;
	BMessage	*msg;
	BPoint		pt;
	drawing_mode	cur_mode = DrawingMode();
	long		clicks;
	
	GetMouse(&pt, &buts);
	msg = Window()->CurrentMessage();
	
	if ((clicks=msg->FindInt32("clicks")) == 1) {
		if (buts & B_SECONDARY_MOUSE_BUTTON) {
			BPopUpMenu	*qMenu = new BPopUpMenu("env sel", true, FALSE);
			
			BPoint			orig = where;
			ConvertToScreen(&where);
			
			BMessage	*msg = new BMessage(SET_DISPLAY_MODE);
			msg->AddInt32("display mode", OBJECT_DISPLAY_SMALL);
			BMenuItem	*item = new BMenuItem("Small", msg);
			qMenu->AddItem(item);
			item->SetTarget(this);
		
			msg = new BMessage(SET_DISPLAY_MODE);
			msg->AddInt32("display mode", OBJECT_DISPLAY_BIG);
			item = new BMenuItem("Large", msg);
			qMenu->AddItem(item);
			item->SetTarget(this);
		
			qMenu->SetAsyncAutoDestruct(true);
			qMenu->Go(where, true, false, true);
		} else {
			msg = new BMessage(MOVE_OBJECT);
		 	msg->AddPointer("sym_object", this);
		 	
			if (mods & B_SHIFT_KEY) {
				((ObjectViewContainer *)Parent())->AddSelection(this);
			} else {
				((ObjectViewContainer *)Parent())->Select(this);
			}
		
			DragMessage(msg, area);
		}
	} else if (clicks > 1) {	// edit object
		Edit();
	} else {
	}
}
Ejemplo n.º 13
0
BOOL CSetVorlagen::UpdateVorlage()
{
	BOOL		result = FALSE;
	BOOL		found = FALSE;
	CString		key, name, pfad;
	long		typ;

	key  = m_Kode;
	name = m_Name;
	pfad = m_Pfad;
	typ  = m_Typ;
	try {
		Open();
		while ( !IsEOF())
		{
			if ( found = ( key == m_Kode ))
				break;

			MoveNext();
		}
		if ( found )	Edit();
		else			AddNew();

		m_Kode = key;
		m_Name = name;
		m_Pfad = pfad;
		m_Typ  = typ;

		Update();
		Close();

		result = TRUE;

	} catch ( CDBException *e ) {

		AfxMessageBox( e -> m_strError );

	} catch ( CMemoryException *e) {

		AfxMessageBox( g_cbMemoryException );
		e -> Delete();

	} catch (...) {

		AfxMessageBox( g_cbUnhandeledException );
	}

	if ( result )	InitListen();

	return result;
}
Ejemplo n.º 14
0
Status GSNetworkConnector::Update()
{
    while(GameState::myWindow.pollEvent(myEvent))
    {
        if(myEvent.type == sf::Event::Closed)
        {
            return QUIT;
        }

        if(myMenustatus != networkconnector::EDIT)
        {
            if(myEvent.type == sf::Event::KeyPressed && myEvent.key.code == sf::Keyboard::Escape)
            {
                myNextState = new GSMenu(GameState::myWindow, GameState::mySettings, myResourcemanager);
                myResourcemanager = NULL;

                myNextStatus = NEXTSTATE;
            }
            else
            {
                Gui::CheckEvents(myEvent);
            }
        }
        else
        {
            if(myEvent.type == sf::Event::KeyPressed && (myEvent.key.code == sf::Keyboard::Escape || myEvent.key.code == sf::Keyboard::Return))
            {
                myMenustatus = networkconnector::CHOOSE;
            }
            else
            {
                Edit();

                if(myMenupoint == networkconnector::NAME)
                {
                    Gui::SetMenupointText(0, "Name: " + *editstr);
                }
                else if(myMenupoint == networkconnector::IP)
                {
                    Gui::SetMenupointText(1, "Ip: " + *editstr);
                }
                else if(myMenupoint == networkconnector::PORT)
                {
                    Gui::SetMenupointText(2, "Port: " + *editstr);
                }
            }
        }
    }

    return myNextStatus;
}
Ejemplo n.º 15
0
void DatabaseGroupWidget::on_EditButton_clicked()
{
    DatabaseAdminEditGroup g;
    g.SetName(ui->NameLabel->text());
    g.SetDescription(ui->DescriptionLabel->text());
    if(g.exec())
    {
        emit Edit(Id,g.GetName(),g.GetDescription());
        SetName(g.GetName());
        SetDescription(g.GetDescription());
    }


}
Ejemplo n.º 16
0
void Menu()
{
	int c;

	gotoxy(1,6);
	printf("\nMain Menu\n\n");
	printf("1>Add\n");
	printf("2>Edit\n");
	printf("3>search\n");
	printf("4>Delete\n");
	printf("5>Show list\n");
	printf("6>exit\n");

	choice:

	printf("Entere your choice between 1 to 5 \n");
	scanf("%d",&c);

	if(c==1)
	{
		printf("Welcome to Add Menu\n");
		Add();
	}
	else if(c==2)
	{
		Edit();

	}
	else if(c==3)
	{
		Search();
	}
	else if(c==4)
	{
		Delete();
	}
	else if(c==5)
	{
		Showlist();
	}
	else if(c==6)
	{
		exit(1);
	}
	else
	{       printf("Invalid No\n");
		goto choice;
	}
}
Ejemplo n.º 17
0
// keyPressEvent
void EditorDialog::keyPressEvent(QKeyEvent *event)
{
    switch (event->key())
    {
    case Qt::Key_Backspace:
    case Qt::Key_Delete:
        Remove();
        break;
    case Qt::Key_Enter:
        Edit();
        break;
    default:
        QDialog::keyPressEvent(event);
    }
}
Ejemplo n.º 18
0
/**
 * Handle a command for this view (override)
 * @param aCommand command id to be handled
 */
void CAddingPluginView::HandleCommandL( TInt aCommand )
	{
	// [[[ begin generated region: do not modify [Generated Code]
	TBool commandHandled = EFalse;
	switch ( aCommand )
		{	// code to dispatch to the AknView's menu and CBA commands is generated here
	
		case EAddingPluginViewControlPaneRightId:
			commandHandled = Back( aCommand );
			break;
		case EAddingPluginView_MenuItemCommand:
			commandHandled = Add( aCommand );
			break;
		case EAddingPluginView_MenuItem1Command:
			commandHandled = Edit( aCommand );
			break;
		case EAddingPluginView_C_MenuItemCommand:
			commandHandled = Remove( aCommand );
			break;
		case EAddingPluginView_MenuItem4Command:
			commandHandled = Reset( aCommand );
			break;
		case EAddingPluginView_MenuItem2Command:
			commandHandled = Info( aCommand );
			break;
		case EAddingPluginView_MenuItem3Command:
			commandHandled = Back( aCommand );
			break;
		default:
			break;
		}
	
		
	if ( !commandHandled ) 
		{
	
		if ( aCommand == EAddingPluginViewControlPaneRightId )
			{
			AppUi()->HandleCommandL( EEikCmdExit );
			}
	
		}
	// ]]] end generated region [Generated Code]
	
	}
void PartController::Edit(const int partId, QWidget *caller)
{
    Part part;
    try { Databases::parts().findRecord("id", partId); }
    catch (const std::exception &e)
    {
        showErrorDialog(e.what());
        return;
    }

    if (part.null())
    {
        showErrorDialog(("Part with ID " + toString(partId) + " could not be found").c_str());
        return;
    }

    Edit(part, caller);
}
void TaskController::Edit(const int taskId, QWidget *caller)
{
    Task task;
    try { Databases::tasks().findRecord("id", taskId); }
    catch (const std::exception &e)
    {
        showErrorDialog(e.what());
        return;
    }

    if (task.null())
    {
        showErrorDialog(("Task with ID " + toString(taskId) + " could not be found").c_str());
        return;
    }

    Edit(task, caller);
}
void VatRateController::Edit(const int vatRateId, QWidget *caller)
{
    VatRate vatRate;
    try { vatRate = Databases::vatRates().findRecord("id", vatRateId); }
    catch (const std::exception &e)
    {
        showErrorDialog(e.what());
        return;
    }

    if (vatRate.null())
    {
        showErrorDialog(("VAT rate with ID " + toString(vatRateId) + " could not be found").c_str());
        return;
    }

    Edit(vatRate, caller);
}
Ejemplo n.º 22
0
void Edit()
{
	DATA *d;
	String hname;
	int no,cho,i,j;
	puts("編集したいデータの出席番号を入力してください");
	printf("→");
	scanf("%d",&no);
	fflush(stdin);
	
	if(no<=0){
		puts("キャンセルします");
		return;
	}
	
	if(preno>=no){
		d=head;
		while(d->no<no) d=d->next;
		puts("編集する要素を選んでください");
		printf("1.名前 ");
		for(i=0;i<kamo;i++) printf("%d.%s ",i+2,kam[i]);
		printf("\n→");
		scanf("%d",&cho);
		fflush(stdin);
		if(cho==1){
			puts("新しい名前を入力してください");
			hname = (String)malloc(STLEN);
			scanf("%s",hname);
			fflush(stdin);
			strcpy(d->name,hname);
		}else{
			printf("新しい%sの点数を入力してください\n",kam[cho-2]);
			printf("→");
			scanf("%d",&(d->point[cho-2]));
		}
		puts("変更完了");
		
	}else{
		puts("正しい出席番号を入力してください");
		Edit();
	}
	Rank();
}
Ejemplo n.º 23
0
int main()
{
	setlocale(LC_ALL, "Russian");
	while (true)
	{
		//CreateTestFile();
		ShowMenu();
		char choice = getchar();
		switch (choice)
		{
			case '1':
				OpenFile();
				break;
			case '2':
				Add();
				break;
			case '3':
				Print();
				break;
			case '4':
				SaveFile();
				break;
			case '5':
				Edit();
				break;
			case '6':
				Sort();
				break;
			case '7':
				RemoveRange();
				break;
			case '8':
				Exit();
				break;
			default:
				break;
		}
	}
    return 0;
}
Ejemplo n.º 24
0
void CGridBtnCellCombo::OnClick( CPoint PointCellRelative)
{
    // immediately edit if user clicked on scroll down button picture

    int iCtlHit = RelPointInCtl( PointCellRelative);  // Relative point coords
    // returns:  Index of control that this point is within bounds of or -1 if no control matches

    BOOL bHitScrollDown = FALSE;
    if( iCtlHit >= 0)
    {
        // if user clicked on scroll down button picture, then show
        //  the drop-down, too

        UINT uiType = GetDrawCtlType( iCtlHit);
        UINT uiState = GetDrawCtlState( iCtlHit);

        bHitScrollDown =    ( uiType == DFC_SCROLL)
                            && uiState & DFCS_SCROLLDOWN;
    }
    if( bHitScrollDown)
    {
        // invoke the edit, now -- similar to CGridCtl::OnEditCell() logic
        CGridCtrl* pGrid = GetGrid();
        ASSERT( pGrid != NULL);

        CRect rect;
        if (!pGrid->GetCellRect( m_iRow, m_iCol, rect))
            return;

        SendMessageToParent(m_iRow, m_iCol, GVN_BEGINLABELEDIT);

        Edit( m_iRow, m_iCol, rect, PointCellRelative, IDC_INPLACE_CONTROL, VK_LBUTTON);
        return;
    }

    CGridBtnCell::OnClick( PointCellRelative);
}
Ejemplo n.º 25
0
void CSourceODBC::TestFile(void)
{
    {
        SetPosition(0);
        SDBField *colmn = m_database.GetColomn( _T("FILE") );
        CByteArray *p = &colmn->binValue;
        int rew = 432;
    }

    SetPosition(0);
    Edit();
    SDBField *colmn = m_database.GetColomn( _T("FILE") );

    CByteArray *ba = &m_database.GetColomn( _T("FILE") )->binValue;
    ba->RemoveAt(0, ba->GetSize());
    ba->Add(111);

    Set(_T("Comment"), _T("wqe"));
    while(!CanUpdate()) {
        Sleep(10);
    }

    Update();
}
Ejemplo n.º 26
0
int main()
{
	init();
	int n=1;
	while(n!=0){
		puts("");
		puts("");
		puts("/_/_/_/_/_/_/_/_/_/_/_/_/_/");
		puts("1.データの作成");
		puts("2.データの追加");
		puts("3.データの削除");
		puts("4.データの表示");
		puts("5.データをセーブする");
		puts("6.データをロードする");
		puts("7.データの編集");
		puts("0.終了");
		puts("/_/_/_/_/_/_/_/_/_/_/_/_/_/");
		puts("");
		printf("→");
		fflush(stdin);
		scanf("%d",&n);
		fflush(stdin);
		switch(n){
			case 0 :puts("END"); break;
			case 1 :Create(); break;
			case 2 :Add(); break;
			case 3 :Del(); break;
			case 4 :Display(); break;
			case 5 :Output(); break;
			case 6 :Input(); break;
			case 7 :Edit(); break;
			default :puts("正しい値を入力してください"); break;
		}
	}
	return 0;
}
Ejemplo n.º 27
0
// ping hosts list window
static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg ) {
	case WM_INITDIALOG: 
			TranslateDialogDefault( hwndDlg );

			Lock(&data_list_cs, "init options dialog");
			temp_list = data_list;
			Unlock(&data_list_cs);

			for (pinglist_it i = temp_list.begin(); i != temp_list.end(); ++i)
			{
				int index = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->pszLabel);
				SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, index, (LPARAM)&(*i));
			}
		return TRUE;

	case WM_COMMAND:
		if (HIWORD( wParam ) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LST_DEST)
		{
			int sel = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
			if(sel != LB_ERR)
			{
				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTREM), TRUE);
				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTEDIT), TRUE);

				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), (sel > 0));
				int count = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCOUNT, 0, 0);
				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel < count - 1));
			}
		}

		if ( HIWORD( wParam ) == BN_CLICKED )
		{
			switch( LOWORD( wParam ))
			{
			case IDC_BTN_DESTEDIT:
			{
				int sel = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
				if (sel != LB_ERR)
				{
					PINGADDRESS *item = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel, 0);
					PINGADDRESS temp = *item;
					if (Edit(hwndDlg, temp))
					{
						*item = temp;
						SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)sel, 0);
						SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)sel, (LPARAM)item->pszLabel);
						SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)sel, (LPARAM)item);
						SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETCURSEL, (WPARAM)sel, 0);

						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTREM), TRUE);
						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTEDIT), TRUE);
						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), sel > 0);
						int count = SendDlgItemMessage(hwndDlg, IDC_BTN_DESTDOWN, LB_GETCOUNT, 0, 0);
						EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel < count - 1));

						SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
					}
				}
			}
				break;
			case IDC_BTN_DESTADD:

				memset(&add_edit_addr,0,sizeof(add_edit_addr));
				add_edit_addr.cbSize = sizeof(add_edit_addr);
				add_edit_addr.port = -1;
				add_edit_addr.set_status = ID_STATUS_ONLINE;
				add_edit_addr.get_status = ID_STATUS_OFFLINE;
				add_edit_addr.status = PS_NOTRESPONDING;
				add_edit_addr.item_id = 0;
				add_edit_addr.index = (int)temp_list.size();

				if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG3), hwndDlg, DlgProcDestEdit) == IDOK)
				{
					temp_list.push_back(add_edit_addr);

					int index = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)add_edit_addr.pszLabel);
					SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETCURSEL, (WPARAM)index, 0);
					SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)index, (LPARAM)&(temp_list.back()));

					EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTREM), TRUE);
					EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTEDIT), TRUE);

					int sel = (int)temp_list.size() - 1;
					EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), (sel > 0));
					int count = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCOUNT, 0, 0);
					EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel < count - 1));

					SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				}

				break;
			case IDC_BTN_DESTREM:
			{
				int sel = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
				if(sel != LB_ERR) {
					PINGADDRESS *item = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel, 0);
					SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)sel, 0);
					temp_list.remove(*item);
				}

				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTREM), FALSE);
				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTEDIT), FALSE);
				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), FALSE);
				EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), FALSE);

				SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				RefreshWindow(0, 0);
				break;
			}
			case IDC_BTN_DESTDOWN:
				{
					int sel2 = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
					if(sel2 != LB_ERR) {
						PINGADDRESS *item = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel2, 0),
							*item2 = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel2 + 1, 0);
						if(item && item2)
						{
							add_edit_addr = *item;
							*item = *item2;
							*item2 = add_edit_addr;

							// keep indexes the same, as they're used for sorting the binary tree
							int index = item->index, index2 = item2->index;						
							item->index = index2;
							item2->index = index;

							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)sel2, (LPARAM)0);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)sel2, (LPARAM)item->pszLabel);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)sel2, (LPARAM)item);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)(sel2 + 1), (LPARAM)0);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)(sel2 + 1), (LPARAM)item2->pszLabel);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)(sel2 + 1), (LPARAM)item2);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETCURSEL, (WPARAM)(sel2 + 1), 0);

							EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), (sel2 + 1 > 0));
							int count = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCOUNT, 0, 0);
							EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel2 + 1 < count - 1));

							SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
						}
					}
				}
				break;
			case IDC_BTN_DESTUP:
				{
					int sel2 = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
					if(sel2 != LB_ERR) {
						PINGADDRESS *item = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel2, 0),
							*item2 = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel2 - 1, 0);

						if (item && item2)
						{
							add_edit_addr = *item;
							*item = *item2;
							*item2 = add_edit_addr;

							// keep indexes the same, as they're used for sorting the binary tree
							int index = item->index, index2 = item2->index;						
							item->index = index2;
							item2->index = index;

							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)sel2, (LPARAM)0);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)sel2, (LPARAM)item->pszLabel);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)sel2, (LPARAM)item);

							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)(sel2 - 1), (LPARAM)0);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)(sel2 - 1), (LPARAM)item2->pszLabel);
							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)(sel2 - 1), (LPARAM)item2);

							SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETCURSEL, (WPARAM)(sel2 - 1), 0);

							EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), (sel2 - 1 > 0));
							int count = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCOUNT, 0, 0);
							EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel2 - 1 < count - 1));

							SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
						}
					}
				}

				break;
			}
		}
		if(LOWORD(wParam) == IDC_BGCOL
			|| LOWORD(wParam) == IDC_SP_INDENT || LOWORD(wParam) == IDC_SP_ROWHEIGHT)
		{
			SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->code == PSN_APPLY )
		{
			CallService(PLUG "/SetAndSavePingList", (WPARAM)&temp_list, 0);
			CallService(PLUG "/GetPingList", 0, (LPARAM)&temp_list);
			// the following will be affected due to list rebuild event
			//if(hWakeEvent) SetEvent(hWakeEvent);
			return TRUE;
		}
		break;

	}
	return FALSE;
}
Ejemplo n.º 28
0
void PanelView::MessageReceived(BMessage* message)
////////////////////////////////////////////////////////////////////////
{
	switch(message->what)
	{
		case MSG_FILE_SEEK:
			SeekModeOn();
			break;
		case MSG_SEEKING:
			SeekFor(m_SeekTextControl->Text());
			break;
		case MSG_FILE_SEEK_END:
			SeekModeOff();
			break;
		case PATH_MSG_CD_PARENT:
			GotoParent();
			break;
		case PATH_MSG_CD_ROOT:
			GotoRoot();
			break;
		case PATH_MSG_CD_HOME:
			GotoHome();
			break;
		case PATH_MSG_CD_DESKTOP:
			GotoDesktop();
			break;
		case PATH_MSG_CD_DISKS:
			if (m_SeekMode)
				SeekModeOff();
			GotoDisks();
			break;
		case MSG_FILELISTVIEW_SELECTION:
			SelectionChanged();
			break;
		case MSG_PANEL_SELECTED:
			m_LastSelectionTime = real_time_clock_usecs();
			Parent()->Looper()->PostMessage(new BMessage(MSG_UPDATEPANEL_SELECTION));	// To update Panels...

			if (m_SeekMode)
				SeekModeOff();
			break;
		case MSG_ENTER:
			Execute(m_CustomListView->GetSelectedEntry(0));
			break;
		case MSG_SPACE:
			Calculate(m_CustomListView->GetSelectedEntry(0));
			break;
		case MSG_VIEW:	// F3
			View();
			break;
		case MSG_EDIT:	// F4
			Edit();
			break;
		case MSG_COPY:	// F5
			Copy();
			break;
		case MSG_MOVE:
			Move();
			break;
		case MSG_RENAME:	// Shift + F6
			Rename();
			break;
		case MSG_MAKEDIR:	// F7
			MakeDir();
			break;
		case MSG_DELETE:	// F8/Del
			Delete();
			break;
		case MSG_QUIT:	// F10
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		case MSG_RELOAD:	// Reload after MkDir, Copy, Move, Delete...
			{
				BString itemname;
				
				// If there is a given name, let's set the selector to it...
				if (message->FindString("ItemName",&itemname)==B_OK)
					Reload(itemname.String());
				else
					Reload();
//				Rescan();
			}
			break;
		case PANELMENU_MSG_SHOWICONS:
			if (m_PanelMenu_ShowIcons->IsMarked())
			{
				m_PanelMenu_ShowIcons->SetMarked(false);
				m_Setting_ShowIcons = false;
				Reload();
			}
			else
			{
				m_PanelMenu_ShowIcons->SetMarked(true);			
				m_Setting_ShowIcons = true;
				Reload();
			}
			break;
		case B_NODE_MONITOR:
			{
				BEntry entry;
				int32 opcode;
				const char *name;
				entry_ref ref;
				node_ref nref;
				
				if (message->FindInt32("opcode", &opcode) == B_OK)
				{
					switch (opcode)
					{
						case B_ENTRY_CREATED:
							message->FindInt32("device", &ref.device);
							message->FindInt64("directory", &ref.directory);
							message->FindString("name", &name);
							ref.set_name(name);
							entry.SetTo(&ref);
							RescanCreated(&entry);
							break;
						case B_ENTRY_REMOVED:
							message->FindInt32("device", &nref.device);
							message->FindInt64("node", &nref.node);
							RescanRemoved(nref);
							break;
						case B_ENTRY_MOVED:	// or renamed...
							message->FindInt32("device", &nref.device);
							message->FindInt64("node", &nref.node);
							RescanRemoved(nref);
							
							message->FindInt32("device", &ref.device);
							message->FindInt64("to directory", &ref.directory);
							message->FindString("name", &name);
							ref.set_name(name);
							entry.SetTo(&ref);
							RescanCreated(&entry);
							break;
						case B_STAT_CHANGED:
							message->FindInt32("device", &nref.device);
							message->FindInt64("node", &nref.node);
							RescanStat(nref);
							break;
						case B_ATTR_CHANGED:
							message->FindInt32("device", &nref.device);
							message->FindInt64("node", &nref.node);
							RescanAttr(nref);
							break;
						case B_DEVICE_MOUNTED:
							if (m_PanelMode==PM_DISKS)
								Reload();
							break;
						case B_DEVICE_UNMOUNTED:
							if (m_PanelMode==PM_DISKS)
								Reload();
							break;
					}
				}
			}
			break;			
		default:
			BView::MessageReceived(message);
	}	
}
Ejemplo n.º 29
0
// MAIN ---------------------------------
int main(int argc, char *argv[]){
int I;
char buf[255];

#ifdef UNIX
  strcpy(GAME_HOME,getenv("HOME"));
  strcat(GAME_HOME,"/.xpired");
#else
  strcpy(GAME_HOME,".");
#endif

  sprintf(ConfFName,"%s/xpired.cfg",GAME_HOME);

  if(!LoadConfig(ConfFName))
  {
    sprintf(buf,"%s/xpired.cfg",SHARE_DIR);
    LoadConfig(buf);
  }

  sprintf(LFile,"%s/xpired.lvl",SHARE_DIR);

  for (I=1;I<argc;I++){
    if ((!strcmp("--help",argv[I]))||(!strcmp("-h",argv[I]))){
		fprintf(stdout,"Example of usage: %s --nosound -l levelfile.lvl -d demo.dmo\n",argv[0]);
		fprintf(stdout," Switches:\n");
		fprintf(stdout,"   -f, --fullscreen    Toggle fullscreen/windowed\n");
		fprintf(stdout,"   -l  <file>          Load level from <file>\n");
		fprintf(stdout,"   -h, --help          Display this help screen\n");
		fprintf(stdout,"   --version           Display version no.\n");
		return 0;
    }else if (!strcmp("-l",argv[I])){
      strcpy(LFile,argv[++I]);
    }else if (!strcmp("-f",argv[I]) || !strcmp("--fullscreen",argv[I])){
      FULLSCR=!FULLSCR;
    }else if (!strcmp("--version",argv[I])){
		fprintf(stdout,"%s ver. %s \n",APPNAME,VERSION);
		return 0;
	}
  }

	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

	SDL_WM_SetCaption(APPNAME,APPNAME);

  sprintf(buf,"%s/img/icon.bmp",SHARE_DIR);
  
	SDL_WM_SetIcon(IMG_Load(buf), NULL);
	VIDEO_INIT();
	SDL_ShowCursor(SDL_ENABLE);
	SDL_SetEventFilter(E_FILTER);
	SDL_EnableKeyRepeat(0,0);
	SDL_EnableUNICODE(1);

	LoadSprites();
	LoadLevels(LFile);

	if (Shades){
		Sh=SDL_CreateRGBSurface(SDL_SRCALPHA,400,400,BPP,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,screen->format->Amask);
		if (Sh==NULL) fprintf(stderr,"SH neni!!\n");
		SDL_SetColorKey(Sh,SDL_SRCCOLORKEY,SDL_MapRGB(Sh->format,255,0,255));
		SDL_SetAlpha(Sh,SDL_SRCALPHA,Shades);
	}

//--- MNU DEFS
	M_Fg.X=400;
	M_Fg.Top=0;
	M_Fg.Akt=0;
	M_Fg.L=7;
	strcpy(M_Fg.Name,"Fg");
	M_Fg.E[0].Spr=' ';
	M_Fg.E[0].Typ=' ';
	strcpy(M_Fg.E[0].Desc,"None");
	M_Fg.E[1].Spr='X';
	M_Fg.E[1].Typ='X';
	strcpy(M_Fg.E[1].Desc,"Wall");
	M_Fg.E[2].Spr='x';
	M_Fg.E[2].Typ='x';
	strcpy(M_Fg.E[2].Desc,"TinyWall");
	M_Fg.E[3].Spr='c';
	M_Fg.E[3].Typ='c';
	strcpy(M_Fg.E[3].Desc,"Crate");
	M_Fg.E[4].Spr='o';
	M_Fg.E[4].Typ='o';
	strcpy(M_Fg.E[4].Desc,"Barrel");
	M_Fg.E[5].Spr='O';
	M_Fg.E[5].Typ='O';
	strcpy(M_Fg.E[5].Desc,"HiExplosive");
	M_Fg.E[6].Spr='B';
	M_Fg.E[6].Typ='B';
	strcpy(M_Fg.E[6].Desc,"BEM");

	M_Bg.X=420;
	M_Bg.Top=0;
	M_Bg.Akt=0;
	M_Bg.L=8;
	strcpy(M_Bg.Name,"Bg");
	M_Bg.E[0].Spr=' ';
	M_Bg.E[0].Typ=' ';
	strcpy(M_Bg.E[0].Desc,"None");
	M_Bg.E[1].Spr='*';
	M_Bg.E[1].Typ='*';
	strcpy(M_Bg.E[1].Desc,"Start");
	M_Bg.E[2].Spr='+';
	M_Bg.E[2].Typ='+';
	strcpy(M_Bg.E[2].Desc,"Exit");
	M_Bg.E[3].Spr='%';
	M_Bg.E[3].Typ='%';
	strcpy(M_Bg.E[3].Desc,"Retarder");
	M_Bg.E[4].Spr='#';
	M_Bg.E[4].Typ='#';
	strcpy(M_Bg.E[4].Desc,"Ice");
	M_Bg.E[5].Spr='&';
	M_Bg.E[5].Typ='&';
	strcpy(M_Bg.E[5].Desc,"Flamable");
	M_Bg.E[6].Spr='@';
	M_Bg.E[6].Typ='@';
	strcpy(M_Bg.E[6].Desc,"Hot! ");
	M_Bg.E[7].Spr='T';
	M_Bg.E[7].Typ='T';
	strcpy(M_Bg.E[7].Desc,"Teleport");

	strcpy(M_Txt[0],"Name|");
	strcpy(M_Txt[1],"Pw|");
	strcpy(M_Txt[2],"Timer|");
	strcpy(M_Txt[3],"BgImg|");
	strcpy(M_Txt[4],"Msg|");
	strcpy(M_Txt[5],"GoTo|");
	strcpy(M_Txt[6],"Save|");
	M_Txt[7][0]='\0';

	strcpy(M_Msg[0],"T0|");
	strcpy(M_Msg[1],"T1|");
	strcpy(M_Msg[2],"T2|");
	strcpy(M_Msg[3],"T3|");
	strcpy(M_Msg[4],"T4|");
	strcpy(M_Msg[5],"T5|");
	strcpy(M_Msg[6],"T6|");
	strcpy(M_Msg[7],"T7|");
	strcpy(M_Msg[8],"T8|");
	strcpy(M_Msg[9],"T9|");

	Edit();

	SDL_Quit();
	return 0;
}
Ejemplo n.º 30
0
int main()
{
	//show_menu_main();
	BAN b[10];
	int iIndex =0;//No Data
	int choice;
label:	show_menu_main();
	printf("Input that you want choice : \n");
	scanf("%d",&choice);
	switch(choice){
	case 1:
		{
		Show_Create();
		InputMember(b,&iIndex,
			sizeof(b)/sizeof(b[0]));// Input run pointer point to iIndex address, get value iIndex ++
		goto label;
		break;
		}
	case 2:
		{
			Show_Output();
			PrintAll(b,iIndex);
			goto label;
			break;
		}
	case 3:
		Show_Searching();
		int chon;
		printf("Input choice that you searching!!!\n");
		scanf("%d",&chon);
		switch(chon){
		case 1:
			Searching_by_name(b,&iIndex);
			goto label;
			break;
		case 2:
			Searching_by_id(b,iIndex);
			goto label;
			break;
		}
	case 4:
		Show_Modify();
		Modify(b,iIndex);
		goto label;
		break;
	case 11:
		show_menu_EDIT();
		Edit(b,iIndex);
		goto label;
		break;
	case 5:
		show_list_delete();		
		//Delete(b,&iIndex);
		Delete_me(b,&iIndex);
		//PrintAll(b,iIndex);
		goto label;
		break;
	case 6:
		Show_delete_All();
		int de;
		printf("YOU WANT CHOICE ");
		scanf("%d",&de);
		switch(de){
		case 1:
			DeleteAll(b,&iIndex);
			goto label;
			break;
		case 2:
			goto label;
			break;
		}
	case 7:
		{
		show_menu_sort();
		int sort;
		printf("Please Input choice to sort data\n");
		scanf("%d",&sort);
		switch(sort){
		case 1:
			insertSort(b,iIndex);
			PrintAll(b,iIndex);
			goto label;
			break;
		case 2:
			sort_by_shell(b,iIndex);
			goto label;
			break;
		case 3:
			QuickSort(b,0,iIndex-1);
			PrintAll(b,iIndex);
			goto label;
			break;
		case 4:
			Merger_Sort_vision(b,0,iIndex-1);
			PrintAll(b,iIndex);
			goto label;
			break;
		}
		}
		break;
	case 8:
			save(b,iIndex);
			goto label;
		break;
	case 9:
		Show_data_read_file();
		ReadFile_1(b,iIndex,"ds.txt");
		goto label;
		break;
	case 10:
		exit(0);
		break;
	}
	return 0;
}