Exemple #1
0
BOOL UnitEdit::WndProc(TMSG &Msg)
{
	if (Msg.Msg==WM_VSCROLL)
	{
		switch (Msg.wParam)
		{
		case SB_LINEUP:
			if (CanClose())
			{
				double V=GetValue();
				Express(V+pow(floor(log10(V))-2,10));
			}
			break;
		case SB_LINEDOWN:
			if (CanClose())
			{
				double V=GetValue();
				Express(V-pow(floor(log10(V))-2,10));
			}
			break;
		}
	}

	return ((Msg.RetVal=DefProc(hWnd,Msg.Msg,Msg.wParam,Msg.lParam))==0);
}
Exemple #2
0
void CChatBkDlg::OnCancel()
{
	// TODO:  在此添加专用代码和/或调用基类

	if (CanClose())
		CDialog::OnCancel();
}
Exemple #3
0
void CChatBkDlg::OnClose()
{
	// TODO:  在此添加消息处理程序代码和/或调用默认值

	if (CanClose())
		CDialog::OnClose();
}
Exemple #4
0
// could use Window event table for this stuff
BOOL Window::WndProc(TMSG &Msg)
{
	// handle internal actions
	switch (Msg.Msg)
	{
		case WM_QUERYENDSESSION:
		case WM_CLOSE:
			if (!CanClose()) return TRUE; //returns 0
			break;
		case WM_DESTROY:  // quit if main window
			if (this==App::MainWindow) App::Quit();
			if (Flags & W_SAVEPOS) SaveWindowState();
			Flags|=W_DESTROYED;
			Destroy();
			// MainWindow is deleted on program exit
			if (this==App::MainWindow) App::Quit();
			else delete this;
			return TRUE;
		case WM_PAINT:
			PAINTSTRUCT  ps;
			BeginPaint(hWnd, (LPPAINTSTRUCT) &ps);
			SetWindowOrgEx(ps.hdc,xPos,yPos,NULL);
			Paint(ps.hdc,ps.fErase,ps.rcPaint);

			if (StatBar) // draw statbar after window
			{
				SetWindowOrgEx(ps.hdc,0,0,NULL); // dont scroll statbar
				StatBar->Paint(ps.hdc);
			}
			EndPaint(hWnd, (LPPAINTSTRUCT) &ps);
			break;

		case WM_HSCROLL:			HScroll(Msg); break;
		case WM_VSCROLL:			VScroll(Msg); break;
		case WM_SIZE:				WMSize(Msg); break;
		case WM_GETMINMAXINFO:	WMGetMinMaxInfo(Msg); break;
		case WM_COMMAND:
		{
			int id=LOWORD(Msg.wParam);
			if (id>MRU_ID && id<=MRU_ID+MRU_MAX)
			{
				OpenFile(MruList[id-MRU_ID-1]);
				return TRUE;
			}
			else if (id>MRU2_ID && id<=MRU2_ID+MRU_MAX)
			{
				OpenFile2(MruList2[id-MRU2_ID-1]);
				return TRUE;
			}
			break;
		}
		case WM_INITMENU:
			InitMenu((HMENU) Msg.wParam); // handle of menu to initialize 
			break;
 	}
	if (StatBar) StatBar->EV_FIND(Msg);
	//allow user to grab any message
	return EV_FIND(Msg);
}
Exemple #5
0
//done
void TModelessDialog::Destroy(int nStatus)
{
    if (CanClose())
	{
		DestroyWindow(hWindow);
		this->nStatus = nStatus;
	}
}	//TModelessDialog::Destroy
void CRtpBaseFlow::CanClose(const TDesC8& , MSessionControlNotify::TDelete aDelete)
/**
Called from protocol to indicate that a graceful close has completed with disconnect data
*/
	{
	/* Will we ever reach here? */
	CanClose(aDelete);
	}
Exemple #7
0
void
wxMFrame::OnCloseWindow(wxCloseEvent& event)
{
   if ( event.CanVeto() && !mApplication->IsOkToClose(this) && !CanClose() )
   {
      event.Veto();
   }
   else
   {
      Destroy();
   }
}
/*
Called by ProcessMessage to Translate a TWAIN message
*/
void CTwain::TranslateMessage(TW_EVENT& twEvent)
{
	switch(twEvent.TWMessage)
	{
	case MSG_XFERREADY:
			TransferImage();
			break;
	case MSG_CLOSEDSREQ:
			if(CanClose())
			{
				CloseDS();
			}
			break;
	}
}
Exemple #9
0
/*
Called by ProcessMessage to Translate a TWAIN message
*/
void CTwain::TranslateMessage(TW_EVENT& twEvent)
{
	switch(twEvent.TWMessage)
	{
	case MSG_XFERREADY:
		TRACE("********** TranslateMessage --> MSG_XFERREADY ************\n");
			TransferImage();
			break;
	case MSG_CLOSEDSREQ:
		TRACE("********** TranslateMessage --> MSG_CLOSEDSREQ ************\n");
			if(CanClose())
			{
				CloseDS();
			}
			ScanDone(-5);
			break;
	default:
		TRACE("TranslateMessage --> default, twEvent.TWMessage = %d.\n", twEvent.TWMessage);
		break;
	}
}
Exemple #10
0
/*
Called by ProcessMessage to Translate a TWAIN message
*/
void CTwain::TranslateMessage(TW_EVENT& twEvent)
{
	switch(twEvent.TWMessage)
	{
	case MSG_XFERREADY:
		TransferImage();
		break;
	case MSG_CLOSEDSREQ:
		if(CanClose())
		{
			CloseDS();
		}
		break;

	// No message from the Source to the App break;
	// possible new message
	case MSG_NULL:
	default:
		break;
	}
}
Exemple #11
0
void
wxMFrame::OnMenuCommand(int id)
{
   // is it a module generated entry?
   if(id >= WXMENU_MODULES_BEGIN && id < WXMENU_MODULES_END)
   {
      ProcessModulesMenu(id);
      return;
   }

   switch(id)
   {
      case WXMENU_FILE_CLOSE:
         Close();
         break;

      case WXMENU_FILE_COMPOSE_WITH_TEMPLATE:
      case WXMENU_FILE_COMPOSE:
         {
            wxString templ;
            if ( id == WXMENU_FILE_COMPOSE_WITH_TEMPLATE )
            {
               templ = ChooseTemplateFor(MessageTemplate_NewMessage, this);
               if ( templ.empty() )
               {
                  // cancelled by user
                  break;
               }
            }

            Profile_obj profile(GetFolderProfile());
            Composer *composeView = Composer::CreateNewMessage(templ, profile);

            composeView->InitText();
         }
         break;

      case WXMENU_FILE_SEND_OUTBOX:
         mApplication->SendOutbox();
         break;

      case WXMENU_FILE_POST:
         {
            Profile_obj profile(GetFolderProfile());
            Composer *composeView = Composer::CreateNewArticle(profile);

            composeView->InitText();
         }

      case WXMENU_FILE_COLLECT:
         {
            FolderMonitor *mailCollector = mApplication->GetFolderMonitor();
            if ( mailCollector )
            {
               // when the user explicitly checks for the new mail, also update
               // the currently opened folder(s) and give the verbose messages
               mailCollector->CheckNewMail(FolderMonitor::Interactive |
                                           FolderMonitor::Opened);
            }
         }
         break;

#ifdef USE_PYTHON
      case WXMENU_FILE_RUN_PYSCRIPT:
         {
            wxString path = mApplication->GetDataDir();
            if ( !path.empty() )
               path += DIR_SEPARATOR;
            path += _T("scripts");

            wxString filename = MDialog_FileRequester
                                (
                                 _("Please select a Python script to run."),
                                 this,
                                 path, "",
                                 "py", "*.py",
                                 false,
                                 NULL /* profile */
                                );
            if ( !filename.empty() )
            {
               PythonRunScript(filename);
            }
            //else: cancelled by user
         }
         break;
#endif   // USE_PYTHON

      case WXMENU_FILE_AWAY_MODE:
         mApplication->SetAwayMode(GetMenuBar()->IsChecked(id));
         break;

      case WXMENU_FILE_EXIT:
         // flush MEvent queues for safety
         MEventManager::DispatchPending();

         if ( CanClose() )
         {
            // this frame has been already asked whether it wants to exit, so
            // don't ask it again
            mApplication->AddToFramesOkToClose(this);

            // exit the application if other frames don't object
            mApplication->Exit();
         }
         break;

      case WXMENU_FILE_IMPORT:
         ShowImportDialog(this);
         break;

      case WXMENU_EDIT_ADB:
         ShowAdbFrame(this);
         break;

      case WXMENU_EDIT_PREF:
         ShowOptionsDialog(this);
         break;

      case WXMENU_EDIT_FILTERS:
         (void) ConfigureAllFilters(this);
         break;

      case WXMENU_EDIT_MODULES:
         ShowModulesDialog(this);
         break;

      case WXMENU_EDIT_TEMPLATES:
         EditTemplates(this);
         break;

      case WXMENU_EDIT_RESTORE_PREF:
         (void)ShowRestoreDefaultsDialog(mApplication->GetProfile(), this);
         break;

      case WXMENU_EDIT_SAVE_PREF:
         if ( Profile::FlushAll() )
         {
            wxLogStatus(this, _("Program preferences successfully saved."));
         }
         else
         {
            ERRORMESSAGE((_("Couldn't save preferences.")));
         }
         break;

      case WXMENU_EDIT_CONFIG_SOURCES:
         ShowConfigSourcesDialog(this);
         break;

      case WXMENU_EDIT_EXPORT_PREF:
      case WXMENU_EDIT_IMPORT_PREF:
         {
            const bool doExport = id == WXMENU_EDIT_EXPORT_PREF;

            String path = MDialog_FileRequester
                          (
                              doExport ? _("Choose file to export settings to")
                                       : _("Choose file to import settings from"),
                              this,
                              wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
                              doExport    // true => save, false => load
                          );
            if ( path.empty() )
               break;

            ConfigSource_obj
               configSrc(ConfigSourceLocal::CreateDefault()),
               configDst(ConfigSourceLocal::CreateFile(path));
            if ( !doExport )
            {
               configSrc.Swap(configDst);
            }

            bool ok = ConfigSource::Copy(*configDst, *configSrc);

            if ( doExport )
            {
               if ( ok )
               {
                  wxLogStatus(this,
                              _("Settings successfully exported to file \"%s\""),
                              path.c_str());
               }
               else
               {
                  wxLogError(_("Failed to export settings to the file \"%s\"."),
                             path.c_str());
               }
            }
            else // import
            {
               if ( ok )
               {
                  wxLogStatus(this,
                              _("Settings successfully imported from \"%s\""),
                              path.c_str());
               }
               else
               {
                  wxLogError(_("Failed to import settings from the file \"%s\"."),
                             path.c_str());
               }
            }
         }
         break;


      case WXMENU_HELP_ABOUT:
         MDialog_AboutDialog(this, false /* don't timeout */);
         break;

      case WXMENU_HELP_TIP:
         MDialog_ShowTip(this);
         break;

      case WXMENU_HELP_CONTEXT:
         MDialog_Message(_("Help not implemented for current context, yet."),this,_("Sorry"));
         break;

      case WXMENU_HELP_CONTENTS:
         mApplication->Help(MH_CONTENTS,this);
         break;

      case WXMENU_HELP_RELEASE_NOTES:
         mApplication->Help(MH_RELEASE_NOTES,this);
         break;

      case WXMENU_HELP_FAQ:
         mApplication->Help(MH_FAQ,this);
         break;

      case WXMENU_HELP_SEARCH:
         mApplication->Help(MH_SEARCH,this);
         break;

      case WXMENU_HELP_COPYRIGHT:
         mApplication->Help(MH_COPYRIGHT,this);
         break;

         // printing:
      case WXMENU_FILE_PRINT_SETUP:
         OnPrintSetup();
         break;
      case WXMENU_FILE_PAGE_SETUP:
         OnPageSetup();
         break;

#ifdef USE_PS_PRINTING
      case WXMENU_FILE_PRINT_SETUP_PS:
         OnPrintSetup();
         break;

      case WXMENU_FILE_PAGE_SETUP_PS:
         OnPageSetup();
         break;
#endif // USE_PS_PRINTING

#ifdef USE_DIALUP
      case WXMENU_FILE_NET_ON:
         mApplication->GoOnline();
         break;

      case WXMENU_FILE_NET_OFF:
         if(mApplication->CheckOutbox())
         {
            if ( MDialog_YesNoDialog
                 (
                  _("You have outgoing messages queued.\n"
                    "Do you want to send them before going offline?"),
                  this,
                  MDIALOG_YESNOTITLE,
                  M_DLG_YES_DEFAULT,
                  M_MSGBOX_GO_OFFLINE_SEND_FIRST
                 ) )
            {
               mApplication->SendOutbox();
            }
         }
         mApplication->GoOffline();
         break;
#endif // USE_DIALUP

         // create a new identity and edit it
      case WXMENU_FILE_IDENT_ADD:
         {
            wxString ident;
            if ( MInputBox(&ident,
                           _("Mahogany: Create new identity"),
                           _("Enter the identity name:"),
                           this,
                           "NewIdentity") )
            {
               ShowIdentityDialog(ident, this);

               // update the identity combo in the toolbar of the main frame if
               // any (note that this will update all the other existing
               // identity combo boxes as they keep themselves in sync
               // internally)
               //
               // TODO: we really should have a virtual wxMFrame::GetIdentCombo
               //       as we might not always create the main frame in the
               //       future but other frames (e.g. composer) may have the
               //       ident combo as well
               wxMFrame *frameTop = mApplication->TopLevelFrame();
               if ( frameTop )
               {
                  wxToolBar *tbar = frameTop->GetToolBar();
                  if ( tbar )
                  {
                     wxWindow *win = tbar->FindWindow(IDC_IDENT_COMBO);
                     if ( win )
                     {
                        wxChoice *combo = wxDynamicCast(win, wxChoice);
                        combo->Append(ident);
                     }
                  }
                  else
                  {
                     FAIL_MSG(_T("where is the main frames toolbar?"));
                  }
               }

               wxLogStatus(this, _("Created new identity '%s'."), ident.c_str());
            }
         }
         break;

         // change the current identity
      case WXMENU_FILE_IDENT_CHANGE:
         {
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to choose from.\n"
                            "Please create an identity first."));
            }
            else
            {
               identities.Insert(_("Default"), 0);
               int rc = MDialog_GetSelection
                        (
                         _("Select the new identity"),
                         MDIALOG_YESNOTITLE,
                         identities,
                         this
                        );

               if ( rc != -1 )
               {
                  Profile *profile = mApplication->GetProfile();
                  if ( rc == 0 )
                  {
                     // restore the default identity
                     profile->DeleteEntry(GetOptionName(MP_CURRENT_IDENTITY));
                  }
                  else
                  {
                     wxString ident = identities[(size_t)rc];
                     profile->writeEntry(MP_CURRENT_IDENTITY, ident);
                  }

                  // update the identity combo in the toolbar if any
                  wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO);
                  if ( win )
                  {
                     wxChoice *combo = wxDynamicCast(win, wxChoice);
                     combo->SetSelection(rc);
                  }

                  // TODO: should update everything (all options might have
                  //       changed)
               }
               //else: dialog cancelled, nothing to do
            }
         }
         break;

         // edit an identity's parameters
      case WXMENU_FILE_IDENT_EDIT:
         {
            String ident;
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to edit.\n"
                            "Please create an identity first."));
            }
            else
            {
               if ( identities.GetCount() > 1 )             
               {
                  int rc = MDialog_GetSelection
                           (
                            _("Which identity would you like to edit?"),
                            MDIALOG_YESNOTITLE,
                            identities,
                            this
                           );

                  if ( rc != -1 )
                  {
                     ident = identities[(size_t)rc];
                  }
                  //else: dialog was cancelled
               }
               else // only one identity
               {
                  // use the current one
                  ident = READ_APPCONFIG_TEXT(MP_CURRENT_IDENTITY);
               }
            }

            if ( !ident.empty() )
            {
               ShowIdentityDialog(ident, this);
            }
         }
         break;

      case WXMENU_FILE_IDENT_DELETE:
         {
            String ident;
            wxArrayString identities = Profile::GetAllIdentities();
            if ( identities.IsEmpty() )
            {
               wxLogError(_("There are no existing identities to delete."));
            }
            else
            {
               int rc = MDialog_GetSelection
                        (
                         _("Which identity would you like to delete?"),
                         MDIALOG_YESNOTITLE,
                         identities,
                         this
                        );
               if ( rc != -1 )
               {
                  ident = identities[(size_t)rc];
               }
               //else: cancelled
            }

            if ( !ident.empty() )
            {
               Profile *profile = mApplication->GetProfile();

               if ( ident == READ_APPCONFIG(MP_CURRENT_IDENTITY) )
               {
                  // can't keep this one
                  profile->writeEntry(MP_CURRENT_IDENTITY, wxEmptyString);
               }

               // FIXME: will this really work? if there are objects which
               //        use this identity the section will be recreated...
               String identSection;
               identSection << Profile::GetIdentityPath() << '/' << ident;
               profile->DeleteGroup(identSection);

               // update the identity combo in the toolbar if any
               wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO);
               if ( win )
               {
                  wxChoice *combo = wxDynamicCast(win, wxChoice);
                  combo->Delete(combo->FindString(ident));
               }

               wxLogStatus(this, _("Identity '%s' deleted."), ident.c_str());
            }
         }
         break;

      case WXMENU_LANG_SET_DEFAULT:
         {
            static const wxFontEncoding encodingsSupported[] =
            {
               wxFONTENCODING_ISO8859_1,       // West European (Latin1)
               wxFONTENCODING_ISO8859_2,       // Central and East European (Latin2)
               wxFONTENCODING_ISO8859_3,       // Esperanto (Latin3)
               wxFONTENCODING_ISO8859_4,       // Baltic (old) (Latin4)
               wxFONTENCODING_ISO8859_5,       // Cyrillic
               wxFONTENCODING_ISO8859_6,       // Arabic
               wxFONTENCODING_ISO8859_7,       // Greek
               wxFONTENCODING_ISO8859_8,       // Hebrew
               wxFONTENCODING_ISO8859_9,       // Turkish (Latin5)
               wxFONTENCODING_ISO8859_10,      // Variation of Latin4 (Latin6)
               wxFONTENCODING_ISO8859_11,      // Thai
               wxFONTENCODING_ISO8859_12,      // doesn't exist currently, but put it
                                               // here anyhow to make all ISO8859
                                               // consecutive numbers
               wxFONTENCODING_ISO8859_13,      // Baltic (Latin7)
               wxFONTENCODING_ISO8859_14,      // Latin8
               wxFONTENCODING_ISO8859_15,      // Latin9 (a.k.a. Latin0, includes euro)

               wxFONTENCODING_CP1250,          // WinLatin2
               wxFONTENCODING_CP1251,          // WinCyrillic
               wxFONTENCODING_CP1252,          // WinLatin1
               wxFONTENCODING_CP1253,          // WinGreek (8859-7)
               wxFONTENCODING_CP1254,          // WinTurkish
               wxFONTENCODING_CP1255,          // WinHebrew
               wxFONTENCODING_CP1256,          // WinArabic
               wxFONTENCODING_CP1257,          // WinBaltic (almost the same as Latin 7)

               wxFONTENCODING_KOI8,            // == KOI8-R
               wxFONTENCODING_UTF7,            // == UTF-7
               wxFONTENCODING_UTF8,            // == UTF-8
            };

            wxArrayString encDescs;
            encDescs.Add(_("Default 7 bit (US ASCII)"));
            for ( size_t n = 0; n < WXSIZEOF(encodingsSupported); n++ )
            {
               encDescs.Add(
                     wxFontMapper::GetEncodingDescription(
                        encodingsSupported[n]
                     )
               );
            }

            int choice = MDialog_GetSelection
                         (
                           _("Please choose the default encoding:\n"
                             "it will be used by default in both\n"
                             "message viewer and composer."),
                           _("Choose default encoding"),
                           encDescs,
                           this
                         );

            wxFontEncoding enc;
            if ( choice == -1 )
            {
               // cancelled, do nothing
               break;
            }
            else if ( choice == 0 )
            {
               enc = wxFONTENCODING_DEFAULT;
            }
            else
            {
               enc = encodingsSupported[choice - 1];
            }

            // remember the encoding as default
            mApplication->GetProfile()->writeEntry(MP_MSGVIEW_DEFAULT_ENCODING,
                                                   enc);
         }
         break;

      case WXMENU_VIEW_TOOLBAR:
         if ( GetMenuBar()->IsChecked(id) )
         {
            DoCreateToolBar();
         }
         else // hide the toolbar
         {
            delete GetToolBar();
            SetToolBar(NULL);
         }
         break;

      case WXMENU_VIEW_STATUSBAR:
         if ( GetMenuBar()->IsChecked(id) )
         {
            DoCreateStatusBar();
         }
         else // hide the status bar
         {
            delete GetStatusBar();
            SetStatusBar(NULL);
         }
         break;

      case WXMENU_VIEW_FULLSCREEN:
         ShowFullScreen(GetMenuBar()->IsChecked(id));
         break;
   }
}
/////////////////////////////////////////////////////////////////////
// TPreferencesDialog
// ------------------
//
void TPreferencesDialog::CmOk ()
{
	char str[MAX_BITMAPNAME + 1];

	if ( !CanClose() )
		return;

	// Get MAX UNDO
	int max_undo;
	pMaxUndoEdit->GetText(str, MAX_BITMAPNAME + 1);
	max_undo = atoi(str);
	if ( max_undo != MaxUndo )
	{
		if ( (GetUndoName() == NULL && GetRedoName() == NULL) ||
			 Confirm("WARNING: Changing the maximum number of UNDO/REDO "
					 "will free up current UNDO/REDO structure(s).\n"
					 "Are you sure you want to do this ?") )
		{
			CleanupUndo();
			MaxUndo = max_undo;
			InitUndo();
		}
		else
		{
			wsprintf(str, "%d", MaxUndo);
			pMaxUndoEdit->SetText(str);
			return;
		}
	}


	// Floor/Ceiling Texture
	pAboveText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultUpperTexture);
	DefaultUpperTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultUpperTexture, str);

	pNormalText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultWallTexture);
	DefaultWallTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultWallTexture, str);

	pBelowText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultLowerTexture);
	DefaultLowerTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultLowerTexture, str);

	pFloorText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultFloorTexture);
	DefaultFloorTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultFloorTexture, str);

	pCeilingText->GetText (str, MAX_BITMAPNAME + 1);
	FreeMemory (DefaultCeilingTexture);
	DefaultCeilingTexture = (char *)GetMemory (strlen(str)+1);
	strcpy (DefaultCeilingTexture, str);

	// Floor/Ceiling height
	pFloorHeight->GetText (str, 6);
	DefaultFloorHeight = (SHORT)atoi(str);

	pCeilingHeight->GetText (str, 6);
	DefaultCeilingHeight = (SHORT)atoi(str);

#if (COOPERATION_VERSION == 1)
	BuildCoopExecTab();
#endif	// COOPERATION_VERSION


	// Check grid size value
	/*
	if ( GridScale >= 256 ) 		GridScale = 256;
	else if ( GridScale >= 128 ) 	GridScale = 128;
	else if ( GridScale >= 64 ) 	GridScale = 64;
	else if ( GridScale >= 32 ) 	GridScale = 32;
	else if ( GridScale >= 16 ) 	GridScale = 16;
	else if ( GridScale >= 8 ) 		GridScale = 8;
	else                        	GridScale = 0;
	*/

	// Misc boolean options
	AdditiveSelBox  = (pAddSelBoxCheck->GetCheck()  == BF_CHECKED);
	Debug           = (pDebugCheck->GetCheck()      == BF_CHECKED);
	DrawLineDefsLen = (pDrawLengthCheck->GetCheck() == BF_CHECKED);
	Expert          = (pExpertCheck->GetCheck()     == BF_CHECKED);
	Quiet           = (pQuietCheck->GetCheck()      == BF_CHECKED);
	Quieter         = (pQuiterCheck->GetCheck()     == BF_CHECKED);
	Select0         = (pSelect0Check->GetCheck()    == BF_CHECKED);
	AutoScroll      = (pAutoScrollCheck->GetCheck() == BF_CHECKED);

	// Toggle status bar if
	if ( InfoShown != (pInfoBarCheck->GetCheck() == BF_CHECKED) )
		TYPESAFE_DOWNCAST(GetApplication()->GetMainWindow(),
						  TMainFrame)->ToggleStatusBar();
	InfoShown       = (pInfoBarCheck->GetCheck()    == BF_CHECKED);

	// Close Dialog box
	TDialog::CmOk();
}
Exemple #13
0
mixed direct_close_obj(object target){
    return CanClose(this_player());
}
Exemple #14
0
//////////////////////////////////////////////////////////////////////
// TThingEditDialog
// ----------------
//
void TThingEditDialog::CmOk ()
{
	// Cannot close if edit controls not valid
	if ( !CanClose() )
		return;

	if (pDontGenerate->GetCheck() == BF_CHECKED)
		CurThing.flags |= THING_FLAG_DONTGENERATE;
	else
		CurThing.flags &= ~THING_FLAG_DONTGENERATE;

	// Get thing position
	char tmp[20];
	pXPosEdit->GetText(tmp, 9);
	if ( CurThing.xpos != atoi(tmp) )	ConfirmData.pXPosCheck = TRUE;
	CurThing.xpos = atoi(tmp);

	pYPosEdit->GetText(tmp, 9);
	if ( CurThing.ypos != atoi(tmp) )	ConfirmData.pYPosCheck = TRUE;
	CurThing.ypos = atoi(tmp);

	pXExit->GetText(tmp, 9);
	if ( CurThing.xExitPos != atoi(tmp) )	ConfirmData.pExitCheck = TRUE;
	CurThing.xExitPos = atoi(tmp);

	pYExit->GetText(tmp, 9);
	if ( CurThing.yExitPos != atoi(tmp) )	ConfirmData.pExitCheck = TRUE;
	CurThing.yExitPos = atoi(tmp);

	GetAngle();

	pComment->GetWindowText(CurThing.comment,sizeof(CurThing.comment));

	if (CurThing.type == kodEntrance)
	{
//		CurThing.id = SetEntrance(RoomID, CurThing.id, CurThing.xpos, CurThing.ypos, CurThing.angle, CurThing.comment);
	}

	// Update confirm data for X and Y pos
	// DEBUG: This doesn't work !!! (always FALSE)
	// ConfirmData.pXPosCheck = pXPosEdit->IsModified();
	// ConfirmData.pYPosCheck = pYPosEdit->IsModified();

	// Do we made changes ?
	TPtr pThing = &Things[SelThings->objnum];

	if ( memcmp (pThing, &CurThing, sizeof(Thing)) != 0 )
	{
		MadeChanges = TRUE;
	}

	// Update first thing in list
	*pThing = CurThing;

	// If more than one thing, copy selected attributes to them
	if ( SelThings->next != NULL )
	{
		SET_HELP_CONTEXT(Confirming_copy_of_Thing_attributes);

		if ( TConfirmThingDialog (this, ConfirmData).Execute() == IDOK )
		{
			// Copy the selected attributes of CurThing to the selection list
			for (SelPtr cur = SelThings->next ; cur != NULL ; cur = cur->next )
			{
				Thing HUGE *pThing = &Things[cur->objnum];
				Thing ThingBefore = *pThing;	// Copy before changes

				if ( ConfirmData.pXPosCheck )	pThing->xpos  = CurThing.xpos;
				if ( ConfirmData.pYPosCheck )	pThing->ypos  = CurThing.ypos;
				if ( ConfirmData.pAngleCheck )pThing->angle = CurThing.angle;
				if ( ConfirmData.pTypeCheck ) pThing->type  = CurThing.type;
				if ( ConfirmData.pExitCheck )
				{
					pThing->when  = CurThing.when;
					pThing->xExitPos = CurThing.xExitPos;
					pThing->yExitPos = CurThing.yExitPos;
				}
				if ( ConfirmData.pSubTypeCheck) pThing->when = CurThing.when;

				strcpy(pThing->comment,CurThing.comment);
				pThing->flags = CurThing.flags;

				if (pThing->type == kodEntrance)
				{
//					pThing->id = SetEntrance(RoomID, pThing->id, pThing->xpos, pThing->ypos, pThing->angle, pThing->comment);
				}
				// Did we made changes?
				if ( memcmp(pThing, &ThingBefore, sizeof(Thing)) != 0 )
					MadeChanges;
			}
		}
		RESTORE_HELP_CONTEXT();
	}

	// Close dialog box
	TDialog::CmOk();
}