INT_PTR CSearchDialog::OnInitDialog()
{
	HIMAGELIST himl = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48);
	HBITMAP hBitmap = LoadBitmap(GetModuleHandle(0),MAKEINTRESOURCE(IDB_SHELLIMAGES));
	ImageList_Add(himl,hBitmap,NULL);

	m_hDirectoryIcon = ImageList_GetIcon(himl,SHELLIMAGES_NEWTAB,ILD_NORMAL);
	m_hDialogIcon = ImageList_GetIcon(himl,SHELLIMAGES_SEARCH,ILD_NORMAL);

	SendMessage(GetDlgItem(m_hDlg,IDC_BUTTON_DIRECTORY),BM_SETIMAGE,
		IMAGE_ICON,reinterpret_cast<LPARAM>(m_hDirectoryIcon));

	SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon));

	DeleteObject(hBitmap);
	ImageList_Destroy(himl);

	HWND hListView = GetDlgItem(m_hDlg,IDC_LISTVIEW_SEARCHRESULTS);

	ListView_SetExtendedListViewStyleEx(hListView,LVS_EX_GRIDLINES|LVS_EX_DOUBLEBUFFER,
		LVS_EX_GRIDLINES|LVS_EX_DOUBLEBUFFER);

	HIMAGELIST himlSmall;
	Shell_GetImageLists(NULL,&himlSmall);
	ListView_SetImageList(hListView,himlSmall,LVSIL_SMALL);

	SetWindowTheme(hListView,L"Explorer",NULL);

	int i = 0;

	for each(auto ci in m_sdps->m_Columns)
	{
		TCHAR szTemp[128];
		LoadString(GetInstance(),ci.uStringID,szTemp,SIZEOF_ARRAY(szTemp));

		LVCOLUMN lvColumn;
		lvColumn.mask		= LVCF_TEXT;
		lvColumn.pszText	= szTemp;
		ListView_InsertColumn(hListView,i,&lvColumn);

		i++;
	}

	RECT rc;
	GetClientRect(hListView,&rc);

	ListView_SetColumnWidth(hListView,0,(1.0/3.0) * GetRectWidth(&rc));
	ListView_SetColumnWidth(hListView,1,(1.80/3.0) * GetRectWidth(&rc));

	UpdateListViewHeader();

	lCheckDlgButton(m_hDlg,IDC_CHECK_ARCHIVE,m_sdps->m_bArchive);
	lCheckDlgButton(m_hDlg,IDC_CHECK_HIDDEN,m_sdps->m_bHidden);
	lCheckDlgButton(m_hDlg,IDC_CHECK_READONLY,m_sdps->m_bReadOnly);
	lCheckDlgButton(m_hDlg,IDC_CHECK_SYSTEM,m_sdps->m_bSystem);
	lCheckDlgButton(m_hDlg,IDC_CHECK_SEARCHSUBFOLDERS,m_sdps->m_bSearchSubFolders);
	lCheckDlgButton(m_hDlg,IDC_CHECK_CASEINSENSITIVE,m_sdps->m_bCaseInsensitive);
	lCheckDlgButton(m_hDlg,IDC_CHECK_USEREGULAREXPRESSIONS,m_sdps->m_bUseRegularExpressions);

	for each(auto strDirectory in *m_sdps->m_pSearchDirectories)
	{
		SendDlgItemMessage(m_hDlg,IDC_COMBO_DIRECTORY,CB_INSERTSTRING,static_cast<WPARAM>(-1),
			reinterpret_cast<LPARAM>(strDirectory.c_str()));
	}

	for each(auto strPattern in *m_sdps->m_pSearchPatterns)
	{
		SendDlgItemMessage(m_hDlg,IDC_COMBO_NAME,CB_INSERTSTRING,static_cast<WPARAM>(-1),
			reinterpret_cast<LPARAM>(strPattern.c_str()));
	}

	SetDlgItemText(m_hDlg,IDC_COMBO_NAME,m_sdps->m_szSearchPattern);
	SetDlgItemText(m_hDlg,IDC_COMBO_DIRECTORY,m_szSearchDirectory);

	CComboBox::CreateNew(GetDlgItem(m_hDlg,IDC_COMBO_NAME));
	CComboBox::CreateNew(GetDlgItem(m_hDlg,IDC_COMBO_DIRECTORY));

	if(m_sdps->m_bStateSaved)
	{
		/* These dummy values will be in use if these values
		have not previously been saved. */
		if(m_sdps->m_iColumnWidth1 != -1 && m_sdps->m_iColumnWidth2 != -1)
		{
			ListView_SetColumnWidth(hListView,0,m_sdps->m_iColumnWidth1);
			ListView_SetColumnWidth(hListView,1,m_sdps->m_iColumnWidth2);
		}
	}

	m_sdps->RestoreDialogPosition(m_hDlg,true);

	SetFocus(GetDlgItem(m_hDlg,IDC_COMBO_NAME));

	return FALSE;
}
示例#2
0
文件: ctrl.cpp 项目: pgmsoul/GitLib
	INT_PTR UpDown::Create(HWND buddy,HWND parent,int nUpper,int nLower,int nPos)
	{
		if(parent==0)
			parent = GetParent(buddy);
		if(parent==0) return 0;
		DWORD style = GetWindowLong(buddy,GWL_STYLE);
		style |= ES_NUMBER;
		SetWindowLong(buddy,GWL_STYLE,style);
		_Handle = CreateUpDownControl(WS_VISIBLE|WS_CHILD|UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_ARROWKEYS,0,0,0,0,parent,Param->Identity,GetInstance(),buddy,nUpper,nLower,nPos);
		if(_Handle==0){
			Warning(L"UpDown.Create");
			return 0;
		}
		OnCreate.Call(this);
		_QuondamProc = ::SetWindowLongPtr(_Handle,GWLP_WNDPROC,(LONG)(LONG_PTR)_WndPointer.Procedure());
		return (INT_PTR)_Handle;
	}
示例#3
0
/* static */
bool wxAppConsoleBase::IsMainLoopRunning()
{
    const wxAppConsole * const app = GetInstance();

    return app && app->m_mainLoop != NULL;
}
示例#4
0
BOOL CGetPlayerDataCMD::GetData(SGDP::ISDDBConnection* poDBConn, UINT32 dwPlayerID, DT_PLAYER_NOPVP_DATA& stPlayerNoPvpData, DT_PLAYER_PVP_DATA& stPlayerPvpData, UINT16& wErrCode)
{
    //CAutoCycle oAutoCycle(__FUNCTION__);

    wErrCode = FAIL;

    if(!GetPlayerBase(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        wErrCode = GET_NODATA;
        //USR_INFO(_SDT("[%s: %d]: GetPlayerBase failed! playerid:%d"), MSG_MARK, dwPlayerID);    //新增玩家肯定没有
        return FALSE;
    }

    if(!GetPlayerTodayConsume(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        wErrCode = GET_NODATA;
        //USR_INFO(_SDT("[%s: %d]: GetPlayerBase failed! playerid:%d"), MSG_MARK, dwPlayerID);    //新增玩家肯定没有
        return FALSE;
    }

    if(!GetPlayerExt(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetPlayerExt failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetBag(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetBag failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetBuild(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetBuild failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetHeroBase(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetHeroBase failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetHeroExt(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetBag GetHeroExt! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetInstance(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetInstance failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetTask(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetTask failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetRelationData(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetRelationData failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetEvenData(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetEvenData failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetSendFlowerLog(poDBConn, dwPlayerID, stPlayerNoPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetSendFlowerLog failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    if(!GetPvp(poDBConn, dwPlayerID, stPlayerPvpData))
    {
        SYS_CRITICAL(_SDT("[%s: %d]: GetPvp failed! playerid:%d"), MSG_MARK, dwPlayerID);
        return FALSE;
    }

    wErrCode = SUCCESS;

    return TRUE;
}
void ParticleFactory::DestroyParticle(HotParticle* target)
{
	GetInstance().removeParticleFromList(target);
}
示例#6
0
void CWinParent::LoadAccel(wchar_t * accel) {
	hAccel = LoadAccelerators(GetInstance(), accel);
}
示例#7
0
LRESULT RingDockSite::RingdowProc(HWND hWnd,RINGPARAMS param)
{
	switch(param.uMsg)
   {
		case WM_CREATE:
			SetPos(m_rcPos.left,m_rcPos.top);
			SetCursor(m_windowInfo.hCursor);			
			break;
		case WM_COMMAND:			
			if(param.lParam != 0)
				return SendMessage(m_parent->Handle(),param.uMsg,param.wParam,param.lParam);
			else
				return OnDockBarHide(param.wParam);
		case RB_SETBKCOLOR:
			switch(param.wParam)
			{
				case RBIMG_HBITMAP:
					SetBgBmp((HBITMAP)param.lParam);
					return TRUE;
				case RBIMG_IDBMP:
					SetBgBmp((LPCTSTR)param.lParam);
					return TRUE;
				case RBIMG_BKCOLOR:
					SetBgColor(param.lParam);
					return TRUE;
				default:
					return 0;
			}
		case WM_MOVE:
		case WM_SIZE:
			InvalidateRect(m_hWnd,NULL,TRUE);
			return DefaultProc(param);
		case WM_LBUTTONDBLCLK:
			return OnLButtonDbClk(param);
		case WM_LBUTTONDOWN:
			return OnLButtonDown(param);
		case WM_LBUTTONUP:
			return OnLButtonUp(param);
		case WM_MOUSEMOVE:
			return OnMouseMove(param);
		case WM_RBUTTONDOWN:
			return OnRButtonDown(param);
		case WM_NCPAINT:
			return 0;		
		case WM_ERASEBKGND:
			return TRUE;
		case WM_PAINT:
		{
			PAINTSTRUCT ps;
			DrawSite(BeginPaint(m_hWnd,&ps),param);
			EndPaint(m_hWnd,&ps);
			return 0;
      }
		case WM_NOTIFY:
			switch(param.lpnmhdr->code)
			{
				case TTN_NEEDTEXT:
				{
					((LPTOOLTIPTEXT)param.lParam)->hinst = GetInstance();
					return SendMessage(m_parent->Handle(),WM_RINGTOOLTIP,((LPTOOLTIPTEXT)param.lParam)->hdr.idFrom,param.lParam);
				}
				
				//case TBN_DROPDOWN:
				//工具栏DropDown按钮
				//	return SendMessage(param.lpnmhdr->hwndFrom,param);
			}
			if(IsWindowPtr(m_parent))
				return SendMessage(m_parent->Handle(),param);
			return DefaultProc(param);
	   case WM_CLOSE:
      	Show(SW_HIDE);
         break;
		//case WM_WINDOWPOSCHANGED:
		//	InvalidateRect(m_hWnd,NULL,FALSE);
		//	return 0;
		case WM_MEASUREITEM:
		{
			RingCoolMenu* rm = GetDockMenu();
			if(rm)
				rm->MeasureItem(param.lpmeasureitem);				
			return SendMessage(m_parent->Handle(),param.uMsg,param.wParam,param.lParam);
		}
      case WM_DRAWITEM:
		{
			RingCoolMenu* rm = GetDockMenu();
			if(rm)
				rm->Draw(param.lpdrawitem);			
			return SendMessage(m_parent->Handle(),param.uMsg,param.wParam,param.lParam);
		}
		//case WM_EXITSIZEMOVE:
		//	InvalidateRect(m_hWnd,NULL,TRUE);
		//	break;
		default:
		{	
			LRESULT res = CtlColorProc(hWnd,param);
			if(res != RM_NOTPROCESS)
				return res;
			else
				return RingWnd::DefaultProc(param);
		}
   }
   return 0;
}
void ContourModelWriterFactory::UnRegisterOneFactory(void)
{
  ObjectFactoryBase::UnRegisterFactory( GetInstance().GetPointer() );
}
void CManageBookmarksDialog::SetupToolbar()
{
	m_hToolbar = CreateToolbar(m_hDlg,
		WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|
		TBSTYLE_TOOLTIPS|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|
		TBSTYLE_FLAT|CCS_NODIVIDER|CCS_NORESIZE,
		TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DRAWDDARROWS|
		TBSTYLE_EX_DOUBLEBUFFER|TBSTYLE_EX_HIDECLIPPEDBUTTONS);

	SendMessage(m_hToolbar,TB_SETBITMAPSIZE,0,MAKELONG(16,16));
	SendMessage(m_hToolbar,TB_BUTTONSTRUCTSIZE,static_cast<WPARAM>(sizeof(TBBUTTON)),0);

	m_himlToolbar = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48);
	HBITMAP hBitmap = LoadBitmap(GetInstance(),MAKEINTRESOURCE(IDB_SHELLIMAGES));
	ImageList_Add(m_himlToolbar,hBitmap,NULL);
	DeleteObject(hBitmap);
	SendMessage(m_hToolbar,TB_SETIMAGELIST,0,reinterpret_cast<LPARAM>(m_himlToolbar));

	TBBUTTON tbb;
	TCHAR szTemp[64];

	tbb.iBitmap		= SHELLIMAGES_BACK;
	tbb.idCommand	= TOOLBAR_ID_BACK;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,0,reinterpret_cast<LPARAM>(&tbb));

	tbb.iBitmap		= SHELLIMAGES_FORWARD;
	tbb.idCommand	= TOOLBAR_ID_FORWARD;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,1,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_ORGANIZE,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_COPY;
	tbb.idCommand	= TOOLBAR_ID_ORGANIZE;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,2,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_VIEWS,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_VIEWS;
	tbb.idCommand	= TOOLBAR_ID_VIEWS;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,3,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_IMPORTEXPORT,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_PROPERTIES;
	tbb.idCommand	= TOOLBAR_ID_IMPORTEXPORT;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,4,reinterpret_cast<LPARAM>(&tbb));

	RECT rcTreeView;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_TREEVIEW),&rcTreeView);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcTreeView),2);

	RECT rcSearch;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_EDITSEARCH),&rcSearch);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcSearch),2);

	DWORD dwButtonSize = static_cast<DWORD>(SendMessage(m_hToolbar,TB_GETBUTTONSIZE,0,0));
	SetWindowPos(m_hToolbar,NULL,rcTreeView.left,rcSearch.top - (HIWORD(dwButtonSize) - GetRectHeight(&rcSearch)) / 2,
		rcSearch.left - rcTreeView.left - 10,HIWORD(dwButtonSize),0);
}
示例#10
0
/*
================
rvGEApp::HandleCommand

Handles the WM_COMMAND message
================
*/
int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam )
{
    HWND		   active;
    rvGEWorkspace* workspace = GetActiveWorkspace ( &active );

    // The recent file list needs to be handled specially
    if ( LOWORD(wParam) >= ID_GUIED_FILE_MRU1 && LOWORD(wParam) < ID_GUIED_FILE_MRU1 + rvGEOptions::MAX_MRU_SIZE )
    {
        OpenFile ( mOptions.GetRecentFile ( mOptions.GetRecentFileCount() - (LOWORD(wParam)-ID_GUIED_FILE_MRU1) - 1 ) );
        return 0;
    }

    switch ( LOWORD ( wParam ) )
    {
    case ID_GUIED_SOURCECONTROL_CHECKIN:
        assert ( workspace );
        HandleCommandSave ( workspace, workspace->GetFilename ( ) );
        workspace->CheckIn ( );
        break;

    case ID_GUIED_SOURCECONTROL_CHECKOUT:
        assert ( workspace );
        workspace->CheckOut ( );
        break;

    case ID_GUIED_SOURCECONTROL_UNDOCHECKOUT:
        assert ( workspace );
        if ( IDYES == MessageBox ( va("Are you sure you want to undo the checkout of the file '%s'?",workspace->GetFilename()), MB_YESNO|MB_ICONQUESTION) )
        {
            workspace->UndoCheckout ( );
        }
        break;

    case ID_GUIED_TOOLS_RELOADMATERIALS:
        SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_WAIT) ) );
        cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadImages\n" );
        cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadMaterials\n" );
        SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
        break;

    case ID_GUIED_EDIT_COPY:
        assert ( workspace );
        workspace->Copy  ( );
        break;

    case ID_GUIED_EDIT_PASTE:
        assert ( workspace );
        workspace->Paste  ( );
        break;

    case ID_GUIED_HELP_ABOUT:
        DialogBox ( GetInstance(), MAKEINTRESOURCE(IDD_GUIED_ABOUT), mMDIFrame, AboutDlg_WndProc );
        break;

    case ID_GUIED_TOOLS_VIEWER:
    {
        if ( mViewer )
        {
            break;
        }

        mViewer = new rvGEViewer;
        if ( !mViewer->Create ( mMDIFrame ) )
        {
            delete mViewer;
            mViewer = NULL;
        }

        if ( workspace )
        {
            if ( !workspace->IsModified () || HandleCommand ( MAKELONG(ID_GUIED_FILE_SAVE,0), 0 ) )
            {
                mViewer->OpenFile ( workspace->GetFilename ( ) );
            }
        }

        SetActiveWindow ( mViewer->GetWindow ( ) );
        break;
    }

    case ID_GUIED_ITEM_MAKESAMESIZEWIDTH:
        assert ( workspace );
        workspace->MakeSelectedSameSize ( true, false );
        break;

    case ID_GUIED_ITEM_MAKESAMESIZEBOTH:
        assert ( workspace );
        workspace->MakeSelectedSameSize ( true, true );
        break;

    case ID_GUIED_ITEM_MAKESAMESIZEHEIGHT:
        assert ( workspace );
        workspace->MakeSelectedSameSize ( false, true );
        break;

    case ID_GUIED_ITEM_ALIGNLEFTS:
        assert ( workspace );
        workspace->AlignSelected ( rvGEWorkspace::ALIGN_LEFTS );
        break;

    case ID_GUIED_ITEM_ALIGNCENTERS:
        assert ( workspace );
        workspace->AlignSelected ( rvGEWorkspace::ALIGN_CENTERS );
        break;

    case ID_GUIED_ITEM_ALIGNRIGHTS:
        assert ( workspace );
        workspace->AlignSelected ( rvGEWorkspace::ALIGN_RIGHTS );
        break;

    case ID_GUIED_ITEM_ALIGNTOPS:
        assert ( workspace );
        workspace->AlignSelected ( rvGEWorkspace::ALIGN_TOPS );
        break;

    case ID_GUIED_ITEM_ALIGNMIDDLES:
        assert ( workspace );
        workspace->AlignSelected ( rvGEWorkspace::ALIGN_MIDDLES );
        break;

    case ID_GUIED_ITEM_ALIGNBOTTOMS:
        assert ( workspace );
        workspace->AlignSelected ( rvGEWorkspace::ALIGN_BOTTOMS );
        break;

    case ID_GUIED_ITEM_ARRANGESENDBACKWARD:
        assert ( workspace );
        workspace->SendSelectedBackward ( );
        break;

    case ID_GUIED_ITEM_ARRANGESENDTOBACK:
        assert ( workspace );
        workspace->SendSelectedToBack( );
        break;

    case ID_GUIED_ITEM_ARRANGEBRINGFORWARD:
        assert ( workspace );
        workspace->BringSelectedForward ( );
        break;

    case ID_GUIED_ITEM_ARRANGEBRINGTOFRONT:
        assert ( workspace );
        workspace->BringSelectedToFront ( );
        break;

    case ID_GUIED_ITEM_ARRANGEMAKECHILD:
        assert ( workspace );
        workspace->MakeSelectedAChild ( );
        break;

    case ID_GUIED_ITEM_PROPERTIES:
        assert ( workspace );
        workspace->EditSelectedProperties ( );
        break;

    case ID_GUIED_ITEM_SCRIPTS:
        assert ( workspace );
        workspace->EditSelectedScripts ( );
        break;

    case ID_GUIED_ITEM_NEWWINDOWDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_NORMAL );
        break;

    case ID_GUIED_ITEM_NEWEDITDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_EDIT );
        break;

    case ID_GUIED_ITEM_NEWHTMLDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_HTML );
        break;

    case ID_GUIED_ITEM_NEWCHOICEDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_CHOICE );
        break;

    case ID_GUIED_ITEM_NEWSLIDERDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_SLIDER );
        break;

    case ID_GUIED_ITEM_NEWLISTDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_LIST );
        break;

    case ID_GUIED_ITEM_NEWBINDDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_BIND );
        break;

    case ID_GUIED_ITEM_NEWRENDERDEF:
        assert ( workspace );
        workspace->AddWindow ( rvGEWindowWrapper::WT_RENDER );
        break;

    case ID_GUIED_WINDOW_TILE:
        SendMessage ( mMDIClient, WM_MDITILE, 0, 0 );
        break;

    case ID_GUIED_WINDOW_CASCADE:
        SendMessage ( mMDIClient, WM_MDICASCADE, 0, 0 );
        break;

    case ID_GUIED_VIEW_STATUSBAR:
    {
        RECT rWindow;

        mStatusBar.Show ( mOptions.GetStatusBarVisible()?false:true );

        GetWindowRect ( mMDIFrame, &rWindow );
        SendMessage ( mMDIFrame, WM_SIZE, 0, MAKELONG ( rWindow.right-rWindow.left, rWindow.bottom-rWindow.top ) );
        break;
    }

    case ID_GUIED_WINDOW_SHOWNAVIGATOR:
        mNavigator.Show ( mOptions.GetNavigatorVisible()?false:true );
        break;

    case ID_GUIED_WINDOW_SHOWPROPERTIES:
        mProperties.Show ( mOptions.GetPropertiesVisible()?false:true );
        break;

    case ID_GUIED_WINDOW_SHOWTRANSFORMER:
        mTransformer.Show ( mOptions.GetTransformerVisible()?false:true  );
        break;

    case ID_GUIED_EDIT_DELETE:
        assert ( workspace );
        workspace->DeleteSelected ( );
        break;

    case ID_GUIED_VIEW_HIDESELECTED:
        assert ( workspace );
        workspace->HideSelected ( );
        break;

    case ID_GUIED_VIEW_UNHIDESELECTED:
        assert ( workspace );
        workspace->UnhideSelected ( );
        break;

    case ID_GUIED_VIEW_SHOWHIDDEN:
        assert ( workspace );
        workspace->ShowHidden ( );
        break;

    case ID_GUIED_EDIT_UNDO:
        assert ( workspace );
        workspace->GetModifierStack().Undo ( );
        mNavigator.Update ( );
        mTransformer.Update ( );
        break;

    case ID_GUIED_EDIT_REDO:
        assert ( workspace );
        workspace->GetModifierStack().Redo ( );
        mNavigator.Update ( );
        mTransformer.Update ( );
        break;

    case ID_GUIED_VIEW_OPTIONS:
        GEOptionsDlg_DoModal ( mMDIFrame );
        break;

    case ID_GUIED_VIEW_SHOWGRID:
        mOptions.SetGridVisible ( mOptions.GetGridVisible()?false:true );
        break;

    case ID_GUIED_VIEW_SNAPTOGRID:
        mOptions.SetGridSnap ( mOptions.GetGridSnap ()?false:true );
        break;

    case ID_GUIED_VIEW_ZOOMIN:
        assert ( workspace );
        workspace->ZoomIn ( );
        break;

    case ID_GUIED_VIEW_ZOOMOUT:
        assert ( workspace );
        workspace->ZoomOut ( );
        break;

    case ID_GUIED_FILE_EXIT:
        DestroyWindow ( mMDIFrame );
        break;

    case ID_GUIED_FILE_CLOSE:
        if ( active )
        {
            assert ( workspace );
            SendMessage ( active, WM_CLOSE, 0, 0 );
        }
        break;

    case ID_GUIED_FILE_NEW:
        NewFile ( );
        break;

    case ID_GUIED_FILE_SAVE:
        assert ( workspace );
        HandleCommandSave ( workspace, workspace->GetFilename ( ) );
        break;

    case ID_GUIED_FILE_SAVEAS:
        assert ( workspace );
        HandleCommandSave ( workspace, NULL );
        break;

    case ID_GUIED_FILE_OPEN:
    {
        OPENFILENAME ofn;
        char		 szFile[MAX_PATH] = "";

        // Initialize OPENFILENAME
        ZeroMemory(&ofn, sizeof(OPENFILENAME));
        ofn.lStructSize = sizeof(OPENFILENAME);
        ofn.hwndOwner = mMDIFrame;
        ofn.lpstrFile = szFile;
        ofn.nMaxFile = sizeof(szFile);
        ofn.lpstrFilter = "GUI Files\0*.GUI\0All Files\0*.*\0";
        ofn.nFilterIndex = 1;
        ofn.lpstrFileTitle = NULL;
        ofn.nMaxFileTitle = 0;
        ofn.lpstrInitialDir = NULL;
        ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

        // Display the Open dialog box.
        if (GetOpenFileName(&ofn)==TRUE)
        {
            OpenFile ( ofn.lpstrFile );
        }
        break;
    }
    }

    return -1;
}
示例#11
0
///////////////////////////////////////////////////////////////////////////////
/// Provides a shared read lock to the table with the given identifier.
/// @pre None.
/// @post Return a lock interface to the stored device table.
/// @param identifier The name of the device table to obtain a lock on.
/// @return Shared pointer to a read lock over the specified table.
/// @limitations None.
///////////////////////////////////////////////////////////////////////////////
CTableManager::TReader CTableManager::AsReader( std::string identifier )
{
    Logger.Trace << __PRETTY_FUNCTION__ << std::endl;
    return TReader( new TReadLock(GetInstance(identifier)) );
}
示例#12
0
int Timer::GetMilliSecond() {
  Timer &timer = GetInstance();
  return timer.curr_ms_ - timer.start_ms_;
}
示例#13
0
void Timer::Tick() {
  int curr = GetSysMilliSecond();
  Timer &timer = GetInstance();
  timer.curr_ms_ = curr;
}
INT_PTR CDestroyFilesDialog::OnInitDialog()
{
	m_hDialogIcon = LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(IDI_MAIN_SMALL));
	SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon));

	HWND hListView = GetDlgItem(m_hDlg,IDC_DESTROYFILES_LISTVIEW);

	HIMAGELIST himlSmall;
	Shell_GetImageLists(NULL,&himlSmall);
	ListView_SetImageList(hListView,himlSmall,LVSIL_SMALL);

	SetWindowTheme(hListView,L"Explorer",NULL);

	ListView_SetExtendedListViewStyleEx(hListView,
		LVS_EX_DOUBLEBUFFER|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES,
		LVS_EX_DOUBLEBUFFER|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);

	LVCOLUMN lvColumn;
	TCHAR szTemp[128];

	LoadString(GetInstance(),IDS_DESTROY_FILES_COLUMN_FILE,
		szTemp,SIZEOF_ARRAY(szTemp));
	lvColumn.mask		= LVCF_TEXT;
	lvColumn.pszText	= szTemp;
	ListView_InsertColumn(hListView,0,&lvColumn);

	LoadString(GetInstance(),IDS_DESTROY_FILES_COLUMN_TYPE,
		szTemp,SIZEOF_ARRAY(szTemp));
	lvColumn.mask		= LVCF_TEXT;
	lvColumn.pszText	= szTemp;
	ListView_InsertColumn(hListView,1,&lvColumn);

	LoadString(GetInstance(),IDS_DESTROY_FILES_COLUMN_SIZE,
		szTemp,SIZEOF_ARRAY(szTemp));
	lvColumn.mask		= LVCF_TEXT;
	lvColumn.pszText	= szTemp;
	ListView_InsertColumn(hListView,2,&lvColumn);

	LoadString(GetInstance(),IDS_DESTROY_FILES_COLUMN_DATE_MODIFIED,
		szTemp,SIZEOF_ARRAY(szTemp));
	lvColumn.mask		= LVCF_TEXT;
	lvColumn.pszText	= szTemp;
	ListView_InsertColumn(hListView,3,&lvColumn);

	int iItem = 0;

	for each(auto strFullFilename in m_FullFilenameList)
	{
		TCHAR szFullFilename[MAX_PATH];

		StringCchCopy(szFullFilename,SIZEOF_ARRAY(szFullFilename),
			strFullFilename.c_str());

		/* TODO: Perform in background thread. */
		SHFILEINFO shfi;
		SHGetFileInfo(szFullFilename,0,&shfi,sizeof(shfi),SHGFI_SYSICONINDEX|
			SHGFI_TYPENAME);

		LVITEM lvItem;
		lvItem.mask		= LVIF_TEXT|LVIF_IMAGE;
		lvItem.iItem	= iItem;
		lvItem.iSubItem	= 0;
		lvItem.pszText	= szFullFilename;
		lvItem.iImage	 = shfi.iIcon;
		ListView_InsertItem(hListView,&lvItem);

		ListView_SetItemText(hListView,iItem,1,shfi.szTypeName);

		WIN32_FILE_ATTRIBUTE_DATA wfad;
		GetFileAttributesEx(szFullFilename,GetFileExInfoStandard,&wfad);

		TCHAR szFileSize[32];
		ULARGE_INTEGER lFileSize = {wfad.nFileSizeLow,wfad.nFileSizeHigh};
		FormatSizeString(lFileSize,szFileSize,SIZEOF_ARRAY(szFileSize));
		ListView_SetItemText(hListView,iItem,2,szFileSize);

		TCHAR szDateModified[32];
		CreateFileTimeString(&wfad.ftLastWriteTime,szDateModified,
			SIZEOF_ARRAY(szDateModified),m_bShowFriendlyDates);
		ListView_SetItemText(hListView,iItem,3,szDateModified);

		iItem++;
	}
示例#15
0
void DevAllocatorManager::UnlockExecutorList(void)
{
     DevAllocatorManager * manager=GetInstance();
     TEngineUnlock(manager->list_lock);
}
void CManageBookmarksDialog::ShowViewMenu()
{
	DWORD dwButtonState = static_cast<DWORD>(SendMessage(m_hToolbar,TB_GETSTATE,TOOLBAR_ID_VIEWS,MAKEWORD(TBSTATE_PRESSED,0)));
	SendMessage(m_hToolbar,TB_SETSTATE,TOOLBAR_ID_VIEWS,MAKEWORD(dwButtonState|TBSTATE_PRESSED,0));

	HMENU hMenu = LoadMenu(GetInstance(),MAKEINTRESOURCE(IDR_MANAGEBOOKMARKS_VIEW_MENU));

	UINT uCheck;

	if(m_pmbdps->m_bSortAscending)
	{
		uCheck = IDM_MB_VIEW_SORTASCENDING;
	}
	else
	{
		uCheck = IDM_MB_VIEW_SORTDESCENDING;
	}

	CheckMenuRadioItem(hMenu,IDM_MB_VIEW_SORTASCENDING,IDM_MB_VIEW_SORTDESCENDING,uCheck,MF_BYCOMMAND);

	switch(m_pmbdps->m_SortMode)
	{
	case NBookmarkHelper::SM_NAME:
		uCheck = IDM_MB_VIEW_SORTBYNAME;
		break;

	case NBookmarkHelper::SM_LOCATION:
		uCheck = IDM_MB_VIEW_SORTBYLOCATION;
		break;

	case NBookmarkHelper::SM_VISIT_DATE:
		uCheck = IDM_MB_VIEW_SORTBYVISITDATE;
		break;

	case NBookmarkHelper::SM_VISIT_COUNT:
		uCheck = IDM_MB_VIEW_SORTBYVISITCOUNT;
		break;

	case NBookmarkHelper::SM_ADDED:
		uCheck = IDM_MB_VIEW_SORTBYADDED;
		break;

	case NBookmarkHelper::SM_LAST_MODIFIED:
		uCheck = IDM_MB_VIEW_SORTBYLASTMODIFIED;
		break;
	}

	CheckMenuRadioItem(hMenu,IDM_MB_VIEW_SORTBYNAME,IDM_MB_VIEW_SORTBYLASTMODIFIED,uCheck,MF_BYCOMMAND);

	RECT rcButton;
	SendMessage(m_hToolbar,TB_GETRECT,TOOLBAR_ID_VIEWS,reinterpret_cast<LPARAM>(&rcButton));

	POINT pt;
	pt.x = rcButton.left;
	pt.y = rcButton.bottom;
	ClientToScreen(m_hToolbar,&pt);

	TrackPopupMenu(GetSubMenu(hMenu,0),TPM_LEFTALIGN,pt.x,pt.y,0,m_hDlg,NULL);
	DestroyMenu(hMenu);

	SendMessage(m_hToolbar,TB_SETSTATE,TOOLBAR_ID_VIEWS,MAKEWORD(dwButtonState,0));
}
示例#17
0
HICON CometConquestGameApp::VGetIcon()
{
	return LoadIcon(GetInstance(), MAKEINTRESOURCE(IDI_ICON1));
}
示例#18
0
bool ModuleDialog::create(UINT resourceId)
{
    return MenuDialog::create(GetInstance(), resourceId, ExtEventGetWindow());
}
	const GlobalSettings* GlobalSettings::GetConstInstance(void)
	{
		return GetInstance();
	}
示例#20
0
long ModuleDialog::showModal(UINT resourceId)
{
    return MenuDialog::showModal(GetInstance(), resourceId, ExtEventGetWindow());
}
示例#21
0
 static TTestApplication& Create(const TApplicationInfo& info) {
     _instance.reset(new TTestApplication(info));
     return *GetInstance();
 }
示例#22
0
bool MenuDialog::createSipPrefControl()
{
#ifdef WIN32_PLATFORM_PSPC
    return NULL != CreateWindow(TEXT("SIPPREF"), NULL, 0, -10, -10, 6, 6, handle(), NULL, GetInstance(), NULL);
#else
    return true;
#endif    
} 
ParticleFactory::~ParticleFactory()
{
	delete[] GetInstance().contingHolder;
	delete[] GetInstance().contingHolderCold;
	
}
示例#24
0
/*
* Document-method: initialize
*
* call-seq: initialize(args)
*
* +args+ should be a Hash and is required
*  This Hash should at least contain +:url+ and +:method+ keys.
*  You may also provide the following optional keys:
*    +:headers+ - should be a Hash of name/value pairs
*    +:response_header_handler+ - can be a string or object that responds to #call
*      If an object was passed, it's #call method will be called and passed the current chunk of data
*    +:response_body_handler+ - can be a string or object that responds to #call
*      If an object was passed, it's #call method will be called and passed the current chunk of data
*    +:payload+ - If +:method+ is either +:post+ or +:put+ this will be used as the request body
*
*/
static VALUE rb_streamly_init(int argc, VALUE * argv, VALUE self) {
  struct curl_instance * instance;
  VALUE args, url, payload, headers, username, password, credentials;

  GetInstance(self, instance);
  instance->handle = curl_easy_init();
  instance->request_headers = NULL;
  instance->request_method = Qnil;
  instance->request_payload_handler = Qnil;
  instance->response_header_handler = Qnil;
  instance->response_body_handler = Qnil;
  instance->options = Qnil;

  rb_scan_args(argc, argv, "10", &args);

    // Ensure our args parameter is a hash
  Check_Type(args, T_HASH);

  instance->request_method = rb_hash_aref(args, sym_method);
  url = rb_hash_aref(args, sym_url);
  payload = rb_hash_aref(args, sym_payload);
  headers = rb_hash_aref(args, sym_headers);
  username = rb_hash_aref(args, sym_username);
  password = rb_hash_aref(args, sym_password);
  instance->response_header_handler = rb_hash_aref(args, sym_response_header_handler);
  instance->response_body_handler = rb_hash_aref(args, sym_response_body_handler);

    // First lets verify we have a :method key
  if (NIL_P(instance->request_method)) {
    rb_raise(eStreamlyError, "You must specify a :method");
  } else {
        // OK, a :method was specified, but if it's POST or PUT we require a :payload
    if (instance->request_method == sym_post || instance->request_method == sym_put) {
      if (NIL_P(payload)) {
        rb_raise(eStreamlyError, "You must specify a :payload for POST and PUT requests");
      }
    }
  }

    // Now verify a :url was provided
  if (NIL_P(url)) {
    rb_raise(eStreamlyError, "You must specify a :url to request");
  }

  if (NIL_P(instance->response_header_handler)) {
    instance->response_header_handler = rb_str_new2("");
#ifdef HAVE_RUBY_ENCODING_H
    rb_encoding *default_internal_enc = rb_default_internal_encoding();
    if (default_internal_enc) {
      instance->response_header_handler = rb_str_export_to_enc(instance->response_header_handler, default_internal_enc);
    } else {
      instance->response_header_handler = rb_str_export_to_enc(instance->response_header_handler, utf8Encoding);
    }
#endif
  }
  if (instance->request_method != sym_head && NIL_P(instance->response_body_handler)) {
    instance->response_body_handler = rb_str_new2("");
#ifdef HAVE_RUBY_ENCODING_H
    rb_encoding *default_internal_enc = rb_default_internal_encoding();
    if (default_internal_enc) {
      instance->response_body_handler = rb_str_export_to_enc(instance->response_body_handler, default_internal_enc);
    } else {
      instance->response_body_handler = rb_str_export_to_enc(instance->response_body_handler, utf8Encoding);
    }
#endif
  }

  if (!NIL_P(headers)) {
    Check_Type(headers, T_HASH);
    rb_iterate(rb_each, headers, each_http_header, self);
    curl_easy_setopt(instance->handle, CURLOPT_HTTPHEADER, instance->request_headers);
  }

    // So far so good, lets start setting up our request

    // Set the type of request
  if (instance->request_method == sym_head) {
    curl_easy_setopt(instance->handle, CURLOPT_NOBODY, 1);
  } else if (instance->request_method == sym_get) {
    curl_easy_setopt(instance->handle, CURLOPT_HTTPGET, 1);
  } else if (instance->request_method == sym_post) {
    curl_easy_setopt(instance->handle, CURLOPT_POST, 1);
    curl_easy_setopt(instance->handle, CURLOPT_POSTFIELDS, RSTRING_PTR(payload));
    curl_easy_setopt(instance->handle, CURLOPT_POSTFIELDSIZE, RSTRING_LEN(payload));

    // (multipart)
    // curl_easy_setopt(instance->handle, CURLOPT_HTTPPOST, 1);

    // TODO: get streaming upload working
    // curl_easy_setopt(instance->handle, CURLOPT_READFUNCTION, &upload_data_handler);
    // curl_easy_setopt(instance->handle, CURLOPT_READDATA, &instance->upload_stream);
    // curl_easy_setopt(instance->handle, CURLOPT_INFILESIZE, len);
  } else if (instance->request_method == sym_put) {
    curl_easy_setopt(instance->handle, CURLOPT_CUSTOMREQUEST, "PUT");
    curl_easy_setopt(instance->handle, CURLOPT_POSTFIELDS, RSTRING_PTR(payload));
    curl_easy_setopt(instance->handle, CURLOPT_POSTFIELDSIZE, RSTRING_LEN(payload));

    // TODO: get streaming upload working
    // curl_easy_setopt(instance->handle, CURLOPT_UPLOAD, 1);
    // curl_easy_setopt(instance->handle, CURLOPT_READFUNCTION, &upload_data_handler);
    // curl_easy_setopt(instance->handle, CURLOPT_READDATA, &instance->upload_stream);
    // curl_easy_setopt(instance->handle, CURLOPT_INFILESIZE, len);
  } else if (instance->request_method == sym_delete) {
    curl_easy_setopt(instance->handle, CURLOPT_CUSTOMREQUEST, "DELETE");
  }

  // Other common options
  curl_easy_setopt(instance->handle, CURLOPT_URL, RSTRING_PTR(url));
  curl_easy_setopt(instance->handle, CURLOPT_FOLLOWLOCATION, 1);
  curl_easy_setopt(instance->handle, CURLOPT_MAXREDIRS, 3);

  // Response header handling
  curl_easy_setopt(instance->handle, CURLOPT_HEADERFUNCTION, &header_handler);
  curl_easy_setopt(instance->handle, CURLOPT_HEADERDATA, instance->response_header_handler);

  // Response body handling
  if (instance->request_method != sym_head) {
    curl_easy_setopt(instance->handle, CURLOPT_ENCODING, "identity, deflate, gzip");
    curl_easy_setopt(instance->handle, CURLOPT_WRITEFUNCTION, &data_handler);
    curl_easy_setopt(instance->handle, CURLOPT_WRITEDATA, instance->response_body_handler);
  }

  if (!NIL_P(username) || !NIL_P(password)) {
    credentials = rb_str_new2("");
    if (!NIL_P(username)) {
      rb_str_buf_cat(credentials, RSTRING_PTR(username), RSTRING_LEN(username));
    }
    rb_str_buf_cat(credentials, ":", 1);
    if (!NIL_P(password)) {
      rb_str_buf_cat(credentials, RSTRING_PTR(password), RSTRING_LEN(password));
    }
    curl_easy_setopt(instance->handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);
    curl_easy_setopt(instance->handle, CURLOPT_USERPWD, RSTRING_PTR(credentials));
    rb_gc_mark(credentials);
  }

  curl_easy_setopt(instance->handle, CURLOPT_SSL_VERIFYPEER, 0);
  curl_easy_setopt(instance->handle, CURLOPT_SSL_VERIFYHOST, 0);

  curl_easy_setopt(instance->handle, CURLOPT_ERRORBUFFER, instance->error_buffer);

  return self;
}
示例#25
0
//------------------------------------------------------------------------------
// Lua member methods
//------------------------------------------------------------------------------
//bool IsNone();
int CvLuaLeague::lIsNone(lua_State* L)
{
	const bool bDoesNotExist = (GetInstance(L, false) == NULL);
	lua_pushboolean(L, bDoesNotExist);
	return 1;
}
示例#26
0
void Joiner::GetJoinerId(Mac::ExtAddress &aJoinerId) const
{
    otPlatRadioGetIeeeEui64(&GetInstance(), aJoinerId.m8);
    ComputeJoinerId(aJoinerId, aJoinerId);
}
示例#27
0
/* static */
wxAppTraits *wxAppConsoleBase::GetTraitsIfExists()
{
    wxAppConsole * const app = GetInstance();
    return app ? app->GetTraits() : NULL;
}
示例#28
0
/**
 * @brief Initializes the SpringApp instance
 * @return whether initialization was successful
 */
bool SpringApp::Initialize ()
{
	logOutput.SetMirrorToStdout(!!configHandler.GetInt("StdoutDebug",0));

	// Initialize class system
	creg::ClassBinder::InitializeClasses ();

	// Initialize crash reporting
#ifdef _MSC_VER
	Install( (LPGETLOGFILE) crashCallback, "[email protected]", "TA Spring Crashreport");
	if (!GetInstance())
	{
		ErrorMessageBox("Error installing crash reporter", "CrashReport error:", MBF_OK);
		return false;
	}
#endif // _MSC_VER
#ifdef __MINGW32__
	CrashHandler::Install();
#endif // __MINGW32__

	FileSystemHandler::Initialize(true);

	if (!ParseCmdLine ())
		return false;

	if (!InitWindow ("RtsSpring"))
	{
		SDL_Quit ();
		return false;
	}

	mouseInput = IMouseInput::Get ();

	// Global structures
	ENTER_SYNCED;
	gs=SAFE_NEW CGlobalSyncedStuff();
	ENTER_UNSYNCED;
	gu=SAFE_NEW CGlobalUnsyncedStuff();

	if (cmdline->result("minimise")) {
		gu->active = false;
		SDL_WM_IconifyWindow();
	}

	// Enable auto quit?
	int quit_time;
	if (cmdline->result("quit", quit_time)) {
		gu->autoQuit = true;
		gu->quitTime = quit_time;
	}

	InitOpenGL();
	palette.Init();

	// Initialize keyboard
	SDL_EnableUNICODE(1);
	SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
	SDL_SetModState (KMOD_NONE);
	
	keys = SAFE_NEW Uint8[SDLK_LAST];
	memset (keys,0,sizeof(Uint8)*SDLK_LAST);

	// Initialize font
	font = SAFE_NEW CglFont(configHandler.GetInt("FontCharFirst", 32),
	                   configHandler.GetInt("FontCharLast", 223),
	                   configHandler.GetString("FontFile", "Luxi.ttf").c_str());

	// Initialize GLEW
	LoadExtensions();
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	SDL_GL_SwapBuffers();

	// Initialize ScriptHandler / LUA
	CScriptHandler::Instance().StartLua();

	// Create CGameSetup and CPreGame objects
	CreateGameSetup ();

	return true;
}
示例#29
0
already_AddRefed<nsPicoService>
nsPicoService::GetInstanceForService()
{
  nsRefPtr<nsPicoService> picoService = GetInstance();
  return picoService.forget();
}
示例#30
0
void CSearchDialog::StartSearching()
{
	ShowWindow(GetDlgItem(m_hDlg, IDC_LINK_STATUS), SW_HIDE);
	ShowWindow(GetDlgItem(m_hDlg, IDC_STATIC_STATUS), SW_SHOW);

	m_AwaitingSearchItems.clear();
	m_SearchItemsMapInternal.clear();

	ListView_DeleteAllItems(GetDlgItem(m_hDlg, IDC_LISTVIEW_SEARCHRESULTS));

	TCHAR szBaseDirectory[MAX_PATH];
	TCHAR szSearchPattern[MAX_PATH];

	/* Get the directory and name, and remove leading and
	trailing whitespace. */
	/* TODO: Verify fields. */
	GetDlgItemText(m_hDlg, IDC_COMBO_DIRECTORY, szBaseDirectory,
		SIZEOF_ARRAY(szBaseDirectory));
	PathRemoveBlanks(szBaseDirectory);
	GetDlgItemText(m_hDlg, IDC_COMBO_NAME, szSearchPattern,
		SIZEOF_ARRAY(szSearchPattern));
	PathRemoveBlanks(szSearchPattern);

	BOOL bSearchSubFolders = IsDlgButtonChecked(m_hDlg, IDC_CHECK_SEARCHSUBFOLDERS) ==
		BST_CHECKED;

	BOOL bUseRegularExpressions = IsDlgButtonChecked(m_hDlg, IDC_CHECK_USEREGULAREXPRESSIONS) ==
		BST_CHECKED;

	BOOL bCaseInsensitive = IsDlgButtonChecked(m_hDlg, IDC_CHECK_CASEINSENSITIVE) ==
		BST_CHECKED;

	/* Turn search patterns of the form '???' into '*???*', and
	use this modified string to search. */
	if(!bUseRegularExpressions && lstrlen(szSearchPattern) > 0)
	{
		if(szSearchPattern[0] != '*' &&
			szSearchPattern[lstrlen(szSearchPattern) - 1] != '*')
		{
			TCHAR szTemp[MAX_PATH];

			StringCchPrintf(szTemp, SIZEOF_ARRAY(szTemp), _T("*%s*"),
				szSearchPattern);
			StringCchCopy(szSearchPattern, SIZEOF_ARRAY(szSearchPattern),
				szTemp);
		}
	}

	DWORD dwAttributes = 0;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_ARCHIVE) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_ARCHIVE;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_HIDDEN) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_HIDDEN;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_READONLY) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_READONLY;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_SYSTEM) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_SYSTEM;

	m_pSearch = new CSearch(m_hDlg, szBaseDirectory, szSearchPattern,
		dwAttributes, bUseRegularExpressions, bCaseInsensitive, bSearchSubFolders);
	m_pSearch->AddRef();

	/* Save the search directory and search pattern (only if they are not
	the same as the most recent entry). */
	BOOL bSaveEntry = FALSE;

	if(m_sdps->m_pSearchDirectories->empty() ||
		lstrcmp(szBaseDirectory, m_sdps->m_pSearchDirectories->begin()->c_str()) != 0)
	{
		bSaveEntry = TRUE;
	}

	if(bSaveEntry)
	{
		SaveEntry(IDC_COMBO_DIRECTORY, *m_sdps->m_pSearchDirectories);
	}

	bSaveEntry = FALSE;

	if(m_sdps->m_pSearchPatterns->empty() ||
		lstrcmp(szSearchPattern, m_sdps->m_pSearchPatterns->begin()->c_str()) != 0)
	{
		bSaveEntry = TRUE;
	}

	if(bSaveEntry)
	{
		SaveEntry(IDC_COMBO_NAME, *m_sdps->m_pSearchPatterns);
	}

	GetDlgItemText(m_hDlg, IDSEARCH, m_szSearchButton, SIZEOF_ARRAY(m_szSearchButton));

	TCHAR szTemp[64];

	LoadString(GetInstance(), IDS_STOP, szTemp, SIZEOF_ARRAY(szTemp));
	SetDlgItemText(m_hDlg, IDSEARCH, szTemp);

	m_bSearching = TRUE;

	/* Create a background thread, and search using it... */
	HANDLE hThread = CreateThread(NULL, 0, NSearchDialog::SearchThread,
		reinterpret_cast<LPVOID>(m_pSearch), 0, NULL);
	CloseHandle(hThread);
}