void CViewCommander::Command_TAB_CLOSERIGHT( void )
{
	if( GetDllShareData().m_Common.m_sTabBar.m_bDispTabWnd ){
		int nGroup = 0;

		// ウィンドウ一覧を取得する
		EditNode* pEditNode;
		int nCount = CAppNodeManager::getInstance()->GetOpenedWindowArr( &pEditNode, TRUE );
		BOOL bSelfFound = FALSE;
		if( 0 >= nCount )return;

		for( int i = 0; i < nCount; i++ ){
			if( pEditNode[i].m_hWnd == GetMainWindow() ){
				pEditNode[i].m_hWnd = NULL;		//自分自身は閉じない
				nGroup = pEditNode[i].m_nGroup;
				bSelfFound = TRUE;
			}else if( !bSelfFound ){
				pEditNode[i].m_hWnd = NULL;		//左は閉じない
			}
		}

		//終了要求を出す
		CAppNodeGroupHandle(nGroup).RequestCloseEditor( pEditNode, nCount, FALSE, TRUE, GetMainWindow() );
		delete []pEditNode;
	}
	return;
}
/* ウィンドウを閉じる */
void CViewCommander::Command_WINCLOSE( void )
{
	/* 閉じる */
	::PostMessage( GetMainWindow(), MYWM_CLOSE, 0, 								// 2007.02.13 ryoji WM_CLOSE→MYWM_CLOSEに変更
		(LPARAM)CAppNodeManager::getInstance()->GetNextTab( GetMainWindow() ) );	// タブまとめ時、次のタブに移動	2013/4/10 Uchi
	return;
}
Пример #3
0
bool VirtualKeyboard::loadKeyboardPack(const std::string &packName)
{
  _kbdGUI->initSize(GetMainWindow().GetWidth(), GetMainWindow().GetHeight());

  _loaded = false;

  bool opened = false;
  opened = openPack(packName, Config::GetConstInstance()->GetDataDir() + "/vkeyb");

  // fallback to the current dir
  if (!opened)
    opened = openPack(packName, ".");

  if (opened) {
    _parser->setParseMode(VirtualKeyboardParser::kParseFull);
    _loaded = _parser->parse();

    if (_loaded) {
      printf("Keyboard pack '%s' loaded successfully\n", packName.c_str());
    } else {
      printf("Error parsing the keyboard pack '%s\n'", packName.c_str());
    }
  } else {
    printf("Keyboard pack not found\n");
  }

  return _loaded;
}
Пример #4
0
bool ScrollBox::Update(const Point2i &mousePosition,
                       const Point2i &lastMousePosition)
{
  // Force redrawing if we are scrolling and the mouse has moved
  if (start_drag_offset!=NO_DRAG && mousePosition!=lastMousePosition) {
    //NeedRedrawing();
  }

  bool redraw = need_redrawing;
  bool updated = Widget::Update(mousePosition, lastMousePosition);
  need_redrawing = redraw;

  bool has_scrollbar = HasScrollBar();
  m_up->SetVisible(has_scrollbar);
  m_down->SetVisible(has_scrollbar);

  updated |= WidgetList::Update(mousePosition, lastMousePosition);

  if (has_scrollbar) {
    GetMainWindow().BoxColor(GetScrollTrack(), dark_gray_color);

    const Rectanglei& thumb = GetScrollThumb();
    bool over = scroll_mode==SCROLL_MODE_THUMB || thumb.Contains(mousePosition);
    GetMainWindow().BoxColor(thumb, over ? white_color : gray_color);
  }
  return updated;
}
Пример #5
0
bool TDocument::AllowClose()
{
	if (IsModified())
	{
		bool save;

		if (!TCommonDialogs::SaveChanges(fTitle, GetMainWindow(), save))
			return false;

		if (save)
		{	
	 		// save the file
	 		if (fFile.IsSpecified())
				Save();
			else
			{
				TFile* file = TCommonDialogs::SaveFile(NULL, GetMainWindow());
				
				if (file)
				{
					SetFile(file);
					Save();
					delete file;
				}
				else
					return false;
			}
		}
	}

	return true;
}
Пример #6
0
static void SoftwareTabView_OnSelectionChanged(void)
{
	int nTab = 0;
	HWND hwndSoftwarePicker;
	HWND hwndSoftwareDevView;
	HWND hwndSoftwareList;

	hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
	hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
	hwndSoftwareList = GetDlgItem(GetMainWindow(), IDC_SOFTLIST);

	nTab = TabView_GetCurrentTab(GetDlgItem(GetMainWindow(), IDC_SWTAB));

	switch(nTab)
	{
		case 0:
			ShowWindow(hwndSoftwarePicker, SW_SHOW);
			ShowWindow(hwndSoftwareDevView, SW_HIDE);
			ShowWindow(hwndSoftwareList, SW_HIDE);
			break;

		case 1:
			ShowWindow(hwndSoftwarePicker, SW_HIDE);
			ShowWindow(hwndSoftwareDevView, SW_SHOW);
			ShowWindow(hwndSoftwareList, SW_HIDE);
			break;
		case 2:
			ShowWindow(hwndSoftwarePicker, SW_HIDE);
			ShowWindow(hwndSoftwareDevView, SW_HIDE);
			ShowWindow(hwndSoftwareList, SW_SHOW);
			break;
	}
}
Пример #7
0
static int SoftwareList_GetItemImage(HWND hwndPicker, int nItem)
{
	iodevice_t nType;
	int nIcon = 0;
	int drvindex = 0;
	const char *icon_name;
	HWND hwndGamePicker = GetDlgItem(GetMainWindow(), IDC_LIST);
	HWND hwndSoftwareList = GetDlgItem(GetMainWindow(), IDC_SOFTLIST);
	drvindex = Picker_GetSelectedItem(hwndGamePicker);
	nType = SoftwareList_GetImageType(hwndSoftwareList, nItem);
	nIcon = GetMessIcon(drvindex, nType);
	if (!nIcon)
	{
		switch(nType)
		{
			case IO_UNKNOWN:
				nIcon = FindIconIndex(IDI_WIN_REDX);
				break;

			default:
				icon_name = lookupdevice(nType)->icon_name;
				if (!icon_name)
					icon_name = device_image_interface::device_typename(nType);
				nIcon = FindIconIndexByName(icon_name);
				if (nIcon < 0)
					nIcon = FindIconIndex(IDI_WIN_UNKNOWN);
				break;
		}
	}
	return nIcon;
}
Пример #8
0
// For frame windows, 'Show' is equivalent to 'Show & Activate'
nsresult nsFrameWindow::Show( PRBool bState)
{
   if( mWnd)
   {
      ULONG ulFlags;
      if( bState) {
         ULONG ulStyle = WinQueryWindowULong( GetMainWindow(), QWL_STYLE);
         ulFlags = SWP_SHOW;
         /* Don't activate the window unless the parent is visible */
         if (WinIsWindowVisible(WinQueryWindow(GetMainWindow(), QW_PARENT)))
           ulFlags |= SWP_ACTIVATE;
         if (!( ulStyle & WS_VISIBLE)) {
            PRInt32 sizeMode;
            GetSizeMode( &sizeMode);
            if ( sizeMode == nsSizeMode_Maximized) {
               ulFlags |= SWP_MAXIMIZE;
            } else if ( sizeMode == nsSizeMode_Minimized) {
               ulFlags |= SWP_MINIMIZE;
            } else {
               ulFlags |= SWP_RESTORE;
            }
         }
         if( ulStyle & WS_MINIMIZED)
            ulFlags |= (SWP_RESTORE | SWP_MAXIMIZE);
      }
      else
         ulFlags = SWP_HIDE | SWP_DEACTIVATE;
      WinSetWindowPos( GetMainWindow(), NULLHANDLE, 0L, 0L, 0L, 0L, ulFlags);
      SetWindowListVisibility( bState);
   }

   return NS_OK;
}
void CViewCommander::Command_GROUPCLOSE( void )
{
	if( GetDllShareData().m_Common.m_sTabBar.m_bDispTabWnd && !GetDllShareData().m_Common.m_sTabBar.m_bDispTabWndMultiWin ){
		int nGroup = CAppNodeManager::getInstance()->GetEditNode( GetMainWindow() )->GetGroup();
		CControlTray::CloseAllEditor( TRUE, GetMainWindow(), TRUE, nGroup );
	}
	return;
}
Пример #10
0
void Menu::DrawBackground()
{
  if (!background) {
    return;
  }
  background->ScaleSize(GetMainWindow().GetSize()+1);
  background->Blit(GetMainWindow(), 0, 0);
}
Пример #11
0
/* Allow us to pre-load the DIB once for future draws */
#ifdef MESS
BOOL LoadScreenShotEx(int nGame, LPCSTR lpSoftwareName, int nType)
#else /* !MESS */
BOOL LoadScreenShot(int nGame, int nType)
#endif /* MESS */
{
	BOOL loaded = FALSE;
	/* No need to reload the same one again */
#ifndef MESS
	if (nGame == current_image_game && nType == current_image_type)
		return TRUE;
#endif

	/* Delete the last ones */
	FreeScreenShot();

	/* Load the DIB */
#ifdef MESS
	if (lpSoftwareName)
	{
		int nParentIndex = -1;
		loaded = LoadSoftwareScreenShot(drivers[nGame], lpSoftwareName, nType);
		if (!loaded && DriverIsClone(nGame) == TRUE)
		{
			nParentIndex = GetParentIndex(drivers[nGame]);
			loaded = LoadSoftwareScreenShot(drivers[nParentIndex], lpSoftwareName, nType);
		}
	}
	if (!loaded)
#endif /* MESS */
	{
		loaded = LoadDIB(drivers[nGame]->name, &m_hDIB, &m_hPal, nType);
	}

	/* If not loaded, see if there is a clone and try that */
	if (!loaded)
	{
		int nParentIndex = GetParentIndex(drivers[nGame]);
		if( nParentIndex >= 0)
		{
			loaded = LoadDIB(drivers[nParentIndex]->name, &m_hDIB, &m_hPal, nType);
			nParentIndex = GetParentIndex(drivers[nParentIndex]);
			if (!loaded && nParentIndex >= 0)
				loaded = LoadDIB(drivers[nParentIndex]->name, &m_hDIB, &m_hPal, nType);
		}
	}

	if (loaded)
	{
		HDC hdc = GetDC(GetMainWindow());
		m_hDDB = DIBToDDB(hdc, m_hDIB, NULL);
		ReleaseDC(GetMainWindow(),hdc);
		
		current_image_game = nGame;
		current_image_type = nType;

	}

	return (loaded) ? TRUE : FALSE;
}
Пример #12
0
void CUISkin::SetWheelChannelChanging(bool fChanging,DWORD Delay)
{
	if (fChanging) {
		if (Delay>0)
			::SetTimer(GetMainWindow(),TIMER_ID_WHEELCHANNELCHANGE,Delay,NULL);
		m_fWheelChannelChanging=true;
	} else if (m_fWheelChannelChanging) {
		::KillTimer(GetMainWindow(),TIMER_ID_WHEELCHANNELCHANGE);
		m_fWheelChannelChanging=false;
	}
}
Пример #13
0
/* Allow us to pre-load the DIB once for future draws */
#ifdef MESS
BOOL LoadScreenShotEx(int nGame, LPCSTR lpSoftwareName, int nType)
#else /* !MESS */
BOOL LoadScreenShot(int nGame, int nType)
#endif /* MESS */
{
	BOOL loaded = FALSE;

	/* No need to reload the same one again */
#ifndef MESS
	if (nGame == current_image_game && nType == current_image_type)
		return TRUE;
#endif

	/* Delete the last ones */
	FreeScreenShot();

	/* Load the DIB */
#ifdef MESS
	if (lpSoftwareName)
	{
		loaded = LoadSoftwareScreenShot(drivers[nGame], lpSoftwareName, nType);
		if (!loaded && (drivers[nGame]->clone_of && !(drivers[nGame]->clone_of->flags & NOT_A_DRIVER)))
			loaded = LoadSoftwareScreenShot(drivers[nGame]->clone_of, lpSoftwareName, nType);
	}
	if (!loaded)
#endif /* MESS */
	{
		loaded = LoadDIB(drivers[nGame]->name, &m_hDIB, &m_hPal, nType);
	}

	/* If not loaded, see if there is a clone and try that */
	if (!loaded
	&&	 (drivers[nGame]->clone_of != NULL)
	&&	!(drivers[nGame]->clone_of->flags & NOT_A_DRIVER))
	{
		loaded = LoadDIB(drivers[nGame]->clone_of->name, &m_hDIB, &m_hPal, nType);
		if (!loaded && drivers[nGame]->clone_of->clone_of)
			loaded = LoadDIB(drivers[nGame]->clone_of->clone_of->name, &m_hDIB, &m_hPal, nType);
	}

	if (loaded)
	{
		HDC hdc = GetDC(GetMainWindow());
		m_hDDB = DIBToDDB(hdc, m_hDIB, NULL);
		ReleaseDC(GetMainWindow(),hdc);
		
		current_image_game = nGame;
		current_image_type = nType;

	}

	return (loaded) ? TRUE : FALSE;
}
Пример #14
0
afx_msg void
CMapPropertiesDialog::OnBrowseBackgroundMusic()
{
  char old_directory[MAX_PATH] = {0};
  GetCurrentDirectory(MAX_PATH, old_directory);
  std::string directory = GetMainWindow()->GetDefaultFolder(WA_SOUND);
  SetCurrentDirectory(directory.c_str());
  CSoundFileDialog dialog(FDM_OPEN);

  if (dialog.DoModal() == IDOK)
  {
    std::string full_path = LPCTSTR(dialog.GetPathName());
    std::string term("sounds");
    size_t pos = full_path.rfind(term);

    if (pos != std::string::npos)
    {
      CString path = full_path.substr(pos + 7).c_str();
      path.Replace('\\', '/');
      SetDlgItemText(IDC_MUSIC, path);
    }

  }

  SetCurrentDirectory(old_directory);
}
void t4p::VersionUpdateViewClass::OnHelpCheckForUpdates(wxCommandEvent& event) {
    wxString currentVersion  = Feature.GetCurrentVersion();
    t4p::VersionUpdateDialogClass dialog(GetMainWindow(),
                                         wxID_ANY, Feature.App.RunningThreads, currentVersion, false,
                                         wxEmptyString);
    dialog.ShowModal();
}
/*!	入力補完
	Ctrl+Spaceでここに到着。
	CEditView::m_bHokan: 現在補完ウィンドウが表示されているかを表すフラグ。

    @date 2001/06/19 asa-o 英大文字小文字を同一視する
                     候補が1つのときはそれに確定する
	@date 2001/06/14 asa-o 参照データ変更
	                 開くプロパティシートをタイプ別に変更y
	@date 2000/09/15 JEPRO [Esc]キーと[x]ボタンでも中止できるように変更
	@date 2005/01/10 genta CEditView_Commandから移動
*/
void CViewCommander::Command_HOKAN( void )
{
#if 0
// 2011.06.24 Moca Plugin導入に従い未設定の確認をやめる
retry:;
	/* 補完候補一覧ファイルが設定されていないときは、設定するように促す。 */
	// 2003.06.22 Moca ファイル内から検索する場合には補完ファイルの設定は必須ではない
	if( m_pCommanderView->m_pTypeData->m_bUseHokanByFile == FALSE &&
		m_pCommanderView->m_pTypeData->m_bUseHokanByKeyword == false &&
		_T('\0') == m_pCommanderView->m_pTypeData->m_szHokanFile[0]
	){
		ConfirmBeep();
		if( IDYES == ::ConfirmMessage( GetMainWindow(),
			LS(STR_ERR_DLGEDITVWHOKAN1)
		) ){
			/* タイプ別設定 プロパティシート */
			if( !CEditApp::getInstance()->m_pcPropertyManager->OpenPropertySheetTypes( 2, GetDocument()->m_cDocType.GetDocumentType() ) ){
				return;
			}
			goto retry;
		}
	}
#endif
	CNativeW	cmemData;
	/* カーソル直前の単語を取得 */
	if( 0 < m_pCommanderView->GetParser().GetLeftWord( &cmemData, 100 ) ){
		m_pCommanderView->ShowHokanMgr( cmemData, TRUE );
	}else{
		InfoBeep(); //2010.04.03 Error→Info
		m_pCommanderView->SendStatusMessage(LS(STR_SUPPORT_NOT_COMPLITE)); // 2010.05.29 ステータスで表示
	}
	return;
}
Пример #17
0
static void SoftwarePicker_EnteringItem(HWND hwndSoftwarePicker, int nItem)
{
	LPCSTR pszFullName;
	LPCSTR pszName;
	const char* tmp;
	LPSTR s;
	int drvindex = 0;
	HWND hwndList;

	hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);

	if (!s_bIgnoreSoftwarePickerNotifies)
	{
		drvindex = Picker_GetSelectedItem(hwndList);

		// Get the fullname and partialname for this file
		pszFullName = SoftwarePicker_LookupFilename(hwndSoftwarePicker, nItem);
		tmp = strrchr(pszFullName, '\\');
		pszName = tmp ? tmp + 1 : pszFullName;

		// Do the dirty work
		MessSpecifyImage(drvindex, NULL, pszFullName);

		// Set up g_szSelectedItem, for the benefit of UpdateScreenShot()
		strncpyz(g_szSelectedItem, pszName, ARRAY_LENGTH(g_szSelectedItem));
		s = strrchr(g_szSelectedItem, '.');
		if (s)
			*s = '\0';

		UpdateScreenShot();
	}
}
Пример #18
0
//////////////////////////////////////////////////////////
// WinDEUApp
// ---------
// Ask for confirmation before exiting application
bool WinDEUApp::CanClose ()
{
	BOOL result;

	// Default member function
	if ( TApplication::CanClose() == FALSE )
		return FALSE;

	TMainFrame *mainFrame = TYPESAFE_DOWNCAST(GetMainWindow(), TMainFrame);
	// Close level editor and return
	if ( mainFrame->inEditor )
	{
		mainFrame->StopEditLevel();
		return FALSE;
	}

	// Last chance message
/*
	result = mainFrame->MessageBox (
				"Do you really want to quit?",
				"Quit",
				MB_YESNO | MB_ICONQUESTION) == IDYES ? TRUE : FALSE ;
*/
	result = TRUE;

	// Close WinHelp
	if ( result && HelpOpened )
	{
		mainFrame->WinHelp(HelpFileName, HELP_QUIT, 0L);
		HelpOpened = FALSE;
	}

	return result;
}
Пример #19
0
INT_PTR CALLBACK DirectXDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	HWND hEdit;

	const char *directx_help =
		MAMEUINAME " requires DirectX version 3 or later, which is a set of operating\r\n"
		"system extensions by Microsoft for Windows 9x, NT and 2000.\r\n\r\n"
		"Visit Microsoft's DirectX web page at http://www.microsoft.com/directx\r\n"
		"download DirectX, install it, and then run " MAMEUINAME " again.\r\n";

	switch (Msg)
	{
	case WM_INITDIALOG:
		hEdit = GetDlgItem(hDlg, IDC_DIRECTX_HELP);
		Edit_SetSel(hEdit, Edit_GetTextLength(hEdit), Edit_GetTextLength(hEdit));
		Edit_ReplaceSel(hEdit, directx_help);
		return 1;

	case WM_COMMAND:
		if (LOWORD(wParam) == IDB_WEB_PAGE)
			ShellExecute(GetMainWindow(), NULL, TEXT("http://www.microsoft.com/directx"),
						 NULL, NULL, SW_SHOWNORMAL);

		if (LOWORD(wParam) == IDCANCEL || LOWORD(wParam) == IDB_WEB_PAGE)
			EndDialog(hDlg, 0);
		return 1;
	}
	return 0;
}
Пример #20
0
static void SoftwareList_EnteringItem(HWND hwndSoftwareList, int nItem)
{
	LPCSTR pszFullName;
	LPCSTR pszFileName;
	int drvindex = 0;
	HWND hwndList;

	hwndList = GetDlgItem(GetMainWindow(), IDC_LIST);

	if (!s_bIgnoreSoftwarePickerNotifies)
	{
		drvindex = Picker_GetSelectedItem(hwndList);

		// Get the fullname and partialname for this file
		pszFileName = SoftwareList_LookupFilename(hwndSoftwareList, nItem); // to run the software
		pszFullName = SoftwareList_LookupFullname(hwndSoftwareList, nItem); // for the screenshot

		strncpyz(g_szSelectedSoftware, pszFileName, ARRAY_LENGTH(g_szSelectedSoftware));

		strncpyz(g_szSelectedDevice, SoftwareList_LookupDevice(hwndSoftwareList, nItem), ARRAY_LENGTH(g_szSelectedDevice));

		// Set up s_szSelecteItem, for the benefit of UpdateScreenShot()
		strncpyz(g_szSelectedItem, pszFullName, ARRAY_LENGTH(g_szSelectedItem));

		UpdateScreenShot();
	}
	drvindex++;
}
Пример #21
0
void TDocument::AddWindow(TTopLevelWindow* window)
{
	TWindowContext::AddWindow(window);
	
	if (fTitle.GetLength() > 0 && window == GetMainWindow())
		window->SetTitle(fTitle);
}
Пример #22
0
void t4p::TotalSearchViewClass::OnTotalSearch(wxCommandEvent& event) {
    std::vector<t4p::TotalTagResultClass> selectedTags;
    int lineNumber = 0;
    t4p::TotalSearchDialogClass dialog(GetMainWindow(), Feature, selectedTags, lineNumber);
    if (wxOK == dialog.ShowModal() && !selectedTags.empty()) {
        for (size_t i = 0; i < selectedTags.size(); ++i) {
            t4p::TotalTagResultClass result = selectedTags[i];
            switch (result.Type) {
            case t4p::TotalTagResultClass::FILE_TAG:
                Feature.OpenFileTag(result.FileTag, lineNumber);
                break;
            case t4p::TotalTagResultClass::TABLE_DATA_TAG:
                Feature.OpenDbData(result.TableTag);
                break;
            case t4p::TotalTagResultClass::TABLE_DEFINITION_TAG:
                Feature.OpenDbTable(result.TableTag);
                break;
            case t4p::TotalTagResultClass::CLASS_TAG:
            case t4p::TotalTagResultClass::FUNCTION_TAG:
            case t4p::TotalTagResultClass::METHOD_TAG:
                Feature.OpenPhpTag(result.PhpTag);
                break;
            }
        }
    }
}
Пример #23
0
void AuditDialog(HWND hParent)
{
	HMODULE hModule = NULL;
	rom_index         = 0;
	roms_correct      = 0;
	roms_incorrect    = 0;
	sample_index      = 0;
	samples_correct   = 0;
	samples_incorrect = 0;

	//RS use Riched32.dll
	hModule = LoadLibrary("Riched32.dll");
	if( hModule )
	{
		DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_AUDIT),hParent,AuditWindowProc);
		FreeLibrary( hModule );
		hModule = NULL;
	}
	else
	{
	    MessageBox(GetMainWindow(),"Unable to Load Riched32.dll","Error",
				   MB_OK | MB_ICONERROR);
	}
	
}
Пример #24
0
	void WMUrgentHandler::Handle (const Entity& e, const NotificationRule&)
	{
		if (e.Additional_ ["org.LC.AdvNotifications.EventCategory"].toString () == "org.LC.AdvNotifications.Cancel")
			return;

		bool ok = false;
		auto winIdx = e.Additional_ ["org.LC.AdvNotifications.WindowIndex"].toInt (&ok);

		auto rootWM = Core::Instance ().GetProxy ()->GetRootWindowsManager ();

		if (winIdx < 0 || winIdx >= rootWM->GetWindowsCount ())
		{
			qWarning () << Q_FUNC_INFO
					<< "invalid window index"
					<< winIdx
					<< "for notification"
					<< e.Additional_;
			winIdx = rootWM->GetPreferredWindowIndex ();
		}

		auto win = rootWM->GetMainWindow (ok ? winIdx : rootWM->GetPreferredWindowIndex ());

		if (!win->isActiveWindow ())
			QApplication::alert (win);
	}
Пример #25
0
void mtlrchApp::InitInstance ()
{
    TApplication::InitInstance();

    // Accept files via drag/drop in the frame window.
    GetMainWindow()->DragAcceptFiles(TRUE);
}
BOOL CFirstInfo::OnQueryCancel( ) {
  //  if (AfxMessageBox(LANG(LANG_J1),MB_OKCANCEL)==IDOK) {
  /* Envoyer un WM_CLOSE à notre fenêtre principale */
  GetMainWindow()->SendMessage(WM_CLOSE,0,0);
  //  }
  return FALSE;
}
Пример #27
0
void Menu::RedrawBackground(const Rectanglei & rect) const
{
  if (!background) {
    return;
  }
  background->Blit(GetMainWindow(), rect, rect.GetPosition());
}
Пример #28
0
void PictureWidget::Draw(const Point2i &/*mousePosition*/)
{
  if (!loaded) {
    if (name.empty())
      return;
    Profile *res = GetResourceManager().LoadXMLProfile("graphism.xml", false);
    SetSurface(LOAD_RES_IMAGE(name), type);

    // Needed to set the resizing
    ApplyScaling(type);
  }

  if (!spr)
    return;

  Surface & surf = GetMainWindow();
  Point2i pos = GetPicturePosition();

  spr->Blit(surf, pos);

  // Draw a transparency mask
  if (disabled) {
    surf.BoxColor(Rectanglei(pos, spr->GetSize()), defaultOptionColorBox);
  }
}
Пример #29
0
void FrameEditor::UpdateFrameViews(bool CopyImageRect)
{
  nuiFixed* pFixed = new nuiFixed();
  mpFrameViewHolder->AddChild(pFixed);
  mpFrameView = new nuiFrameView(mpFrame);
  mpFrameView->AddChild(new nuiLabel(_T("This frame should\nlook nice at any size."), nuiFont::GetFont(20)));
  pFixed->AddChild(mpFrameView);
  
  nuiRectView* pFrameRectView = new nuiRectView(mpFrameView->GetIdealRect());
  mSlotSink.Connect(pFrameRectView->RectChanged, nuiMakeDelegate(this, &FrameEditor::OnFrameViewRectChanged));
	mEventSink.Connect(pFrameRectView->MovedMouse, &FrameEditor::OnFrameMouseMoved);
	pFrameRectView->EnableMouseEvent(true);

  pFrameRectView->SetColor(eShapeStroke, nuiColor(_T("blue")));
  mpFrameViewHolder->AddChild(pFrameRectView);
  
  nuiTexture* pTexture = mpFrame->GetTexture();
	mpImage = new nuiImage(pTexture);
  mpImage->SetPosition(nuiTopLeft);
  mpPictureHolder->AddChild(mpImage);

  if (CopyImageRect)
    mpFrame->SetSourceClientRect(nuiRect(0, 0, pTexture->GetImage()->GetWidth(), pTexture->GetImage()->GetHeight()));
  
  nuiRectView* pRectView = new nuiRectView(mpFrame->GetSourceClientRect());
  mSlotSink.Connect(pRectView->RectChanged, nuiMakeDelegate(this, &FrameEditor::OnFrameRectChanged));
	mEventSink.Connect(pRectView->MovedMouse, &FrameEditor::OnFrameMouseMoved);
	pRectView->EnableMouseEvent(true);
  pRectView->SetColor(eShapeStroke, nuiColor(_T("red")));
  mpPictureHolder->AddChild(pRectView);

  mAttributeScale.Set(mScale);
	
	
	// load attributes editors in inspector	
	mAttributeRect = nuiAttrib<const nuiRect&>(mpFrame->GetAttribute(_T("ClientRect")));
	mAttributeColor = nuiAttrib<const nuiColor&>(mpFrame->GetAttribute(_T("Color")));
	
	
	std::list<nuiAttribBase> attributes;

	attributes.push_back(GetMainWindow()->mAttributeMouseCoord);
	attributes.push_back(mAttributeScale);
	
	ToolPaneAttributes* pTPA = new ToolPaneAttributes(_T("Information"), attributes);
	mpInspector->AddToolpane(pTPA);

	attributes.clear();
	attributes.push_back(mAttributeRect);
	attributes.push_back(mAttributeColor);

	ToolPaneAttributes* pTPA2 = new ToolPaneAttributes(_T("Frame"), attributes);
	mpInspector->AddToolpane(pTPA2);
	
	
	// connect color change signal
	mSlotSink.Connect(mAttributeColor.GetChangedSignal(), nuiMakeDelegate(this, &FrameEditor::OnColorChanged));

}
Пример #30
0
void GraphCanvas::DrawGraph(int x, int y, int w, int h) const
{
  if (!IsVisible())
    return;

  Surface &surface = GetMainWindow();
  uint   graph_h   = h-xaxis.GetHeight()-8;
  uint   graph_w   = w-yaxis.GetWidth()-8;
  uint   graph_x   = x+yaxis.GetWidth()+8;

  if (!results.empty()) {
    // Value to determine normalization
    float  max_value = 0;
    float  xmax      = 0;
    float  xmin      = std::numeric_limits<float>::max();

    for (uint i=0; i<results.size(); i++) {
      if (results[i].ymax > max_value)
        max_value = results[i].ymax;
      if (results[i].xmax > xmax)
        xmax = results[i].xmax;
      if (results[i].list[0].first < xmin)
        xmin = results[i].list[0].first;
    }
    // needed to see correctly energy at the end if two teams have same
    // energy just before the final blow
    xmax += xmax/50.0f;

    char buffer[16];
    snprintf(buffer, 16, "%.1f", xmax);
    surface.Blit(Font::GetInstance(Font::FONT_MEDIUM, Font::FONT_BOLD)->CreateSurface(buffer, black_color),
                 Point2i(x+graph_w-20, y+graph_h+8));
#if 0 // Display max y
    snprintf(buffer, 16, "%.1f", max_value);
    surface.Blit(Font::GetInstance(Font::FONT_MEDIUM, Font::FONT_BOLD)->CreateSurface(buffer, black_color),
                 Point2i(x+4, y+8));
#endif

    // Draw each team graph
    float yscale = graph_h / (1.05f*max_value);
    float xscale = graph_w / (1.05f*(xmax-xmin));

    for (uint i=0; i<results.size(); i++) {
      if (results[i].item) {
        // Legend line
        surface.BoxColor(Rectanglei(x+w-112, y+12+i*40, 56, thickness), results[i].color);
        // Legend icon
        surface.Blit(*results[i].item, Point2i(x+w-48, y+12+i*40-20));
      }
      DrawGraph(i, xmax, xmin, graph_x, xscale, y+graph_h, yscale);
    }
  }

  // Draw here the axis
  surface.BoxColor(Rectanglei(graph_x, y, thickness, graph_h), black_color);
  surface.BoxColor(Rectanglei(graph_x, y+graph_h, graph_w, thickness), black_color);
  surface.Blit(xaxis, Point2i(graph_x+graph_w/2, y+graph_h+8));
  surface.Blit(yaxis, Point2i(x+4, y+graph_h/2));
}