Beispiel #1
0
long SciDoc::onKeyPress(FXObject *o, FXSelector sel, void *p)
{
  FXEvent*ev=(FXEvent*)p;
  switch (ev->code) {
    case KEY_Page_Up:
    case KEY_Page_Down: {
      long ret=FXScintilla::onKeyPress(o,sel,p);
      sendMessage(SCI_SCROLLCARET,0,0);
      return ret;
    }
    case KEY_Tab: { // Ctrl+Tab forces a tab when "UseTabs" is off
      if ((ev->state & CONTROLMASK) && (sendMessage(SCI_GETUSETABS, 0, 0)==0)) {
        sendString(SCI_ADDTEXT, 1, "\t");
        return 1;
      } else { break; }
    }
    case KEY_Menu: {
      ShowPopupMenu(-1,-1);
      return 1;
    }
    case KEY_F10: {
      if (ev->state & SHIFTMASK) {
        ShowPopupMenu(-1,-1);
        return 1;
      } else { break; }
    }
  }
  return FXScintilla::onKeyPress(o,sel,p);
}
Beispiel #2
0
void VisualisationContainer::Init() {
  setWindowTitle(tr("Clementine Visualization"));
  setWindowIcon(QIcon(":/icon.png"));

  // Set up the graphics view
  setScene(vis_);
  setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
  setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setFrameStyle(QFrame::NoFrame);

  // Add the overlay
  overlay_proxy_ = scene()->addWidget(overlay_);
  connect(overlay_, SIGNAL(OpacityChanged(qreal)), SLOT(ChangeOverlayOpacity(qreal)));
  connect(overlay_, SIGNAL(ShowPopupMenu(QPoint)), SLOT(ShowPopupMenu(QPoint)));
  ChangeOverlayOpacity(0.0);

  vis_->SetTextureSize(size_);
  SizeChanged();

  // Selector
  selector_->SetVisualisation(vis_);

  // Settings menu
  menu_->addAction(IconLoader::Load("view-fullscreen"), tr("Toggle fullscreen"),
                   this, SLOT(ToggleFullscreen()));

  QMenu* fps_menu = menu_->addMenu(tr("Framerate"));
  QSignalMapper* fps_mapper = new QSignalMapper(this);
  QActionGroup* fps_group = new QActionGroup(this);
  AddMenuItem(tr("Low (15 fps)"), 15, fps_, fps_group, fps_mapper);
  AddMenuItem(tr("Medium (25 fps)"), 25, fps_, fps_group, fps_mapper);
  AddMenuItem(tr("High (35 fps)"), 35, fps_, fps_group, fps_mapper);
  AddMenuItem(tr("Super high (60 fps)"), 60, fps_, fps_group, fps_mapper);
  fps_menu->addActions(fps_group->actions());
  connect(fps_mapper, SIGNAL(mapped(int)), SLOT(SetFps(int)));

  QMenu* quality_menu = menu_->addMenu(tr("Quality"));
  QSignalMapper* quality_mapper = new QSignalMapper(this);
  QActionGroup* quality_group = new QActionGroup(this);
  AddMenuItem(tr("Low (256x256)"), 256, size_, quality_group, quality_mapper);
  AddMenuItem(tr("Medium (512x512)"), 512, size_, quality_group, quality_mapper);
  AddMenuItem(tr("High (1024x1024)"), 1024, size_, quality_group, quality_mapper);
  quality_menu->addActions(quality_group->actions());
  connect(quality_mapper, SIGNAL(mapped(int)), SLOT(SetQuality(int)));

  menu_->addAction(tr("Select visualizations..."), selector_, SLOT(show()));

  menu_->addSeparator();
  menu_->addAction(IconLoader::Load("application-exit"), tr("Close visualization"),
                   this, SLOT(hide()));
}
Beispiel #3
0
    virtual VOID OnLink(ENLINK *Link)
    {
        switch (Link->msg)
        {
        case WM_LBUTTONUP:
        case WM_RBUTTONUP:
        {
            if (pLink) HeapFree(GetProcessHeap(), 0, pLink);

            pLink = (PWSTR) HeapAlloc(GetProcessHeap(), 0,
                (max(Link->chrg.cpMin, Link->chrg.cpMax) -
                min(Link->chrg.cpMin, Link->chrg.cpMax) + 1) * sizeof(WCHAR));
            if (!pLink)
            {
                /* TODO: Error message */
                return;
            }

            m_RichEdit->SendMessageW(EM_SETSEL, Link->chrg.cpMin, Link->chrg.cpMax);
            m_RichEdit->SendMessageW(EM_GETSELTEXT, 0, (LPARAM) pLink);

            ShowPopupMenu(m_RichEdit->m_hWnd, IDR_LINKMENU, -1);
        }
        break;
        }
    }
Beispiel #4
0
AnalyzerContainer::AnalyzerContainer(QWidget* parent)
    : QWidget(parent),
      current_framerate_(kMediumFramerate),
      context_menu_(new QMenu(this)),
      context_menu_framerate_(new QMenu(tr("Framerate"), this)),
      group_(new QActionGroup(this)),
      group_framerate_(new QActionGroup(this)),
      mapper_(new QSignalMapper(this)),
      mapper_framerate_(new QSignalMapper(this)),
      visualisation_action_(nullptr),
      double_click_timer_(new QTimer(this)),
      ignore_next_click_(false),
      psychedelic_colors_on_(false),
      current_analyzer_(nullptr),
      engine_(nullptr) {
  QHBoxLayout* layout = new QHBoxLayout(this);
  setLayout(layout);
  layout->setContentsMargins(0, 0, 0, 0);

  // Init framerate sub-menu
  AddFramerate(tr("Low (%1 fps)").arg(kLowFramerate), kLowFramerate);
  AddFramerate(tr("Medium (%1 fps)").arg(kMediumFramerate), kMediumFramerate);
  AddFramerate(tr("High (%1 fps)").arg(kHighFramerate), kHighFramerate);
  AddFramerate(tr("Super high (%1 fps)").arg(kSuperHighFramerate),
               kSuperHighFramerate);
  connect(mapper_framerate_, SIGNAL(mapped(int)), SLOT(ChangeFramerate(int)));

  context_menu_->addMenu(context_menu_framerate_);
  context_menu_->addSeparator();

  AddAnalyzerType<BarAnalyzer>();
  AddAnalyzerType<BlockAnalyzer>();
  AddAnalyzerType<BoomAnalyzer>();
  AddAnalyzerType<Sonogram>();
  AddAnalyzerType<TurbineAnalyzer>();
  AddAnalyzerType<NyanCatAnalyzer>();
  AddAnalyzerType<RainbowDashAnalyzer>();

  connect(mapper_, SIGNAL(mapped(int)), SLOT(ChangeAnalyzer(int)));
  disable_action_ = context_menu_->addAction(tr("No analyzer"), this,
                                             SLOT(DisableAnalyzer()));
  disable_action_->setCheckable(true);
  group_->addAction(disable_action_);

  context_menu_->addSeparator();
  psychedelic_enable_ = context_menu_->addAction(
      tr("Use Psychedelic Colors"), this, SLOT(TogglePsychedelicColors()));
  psychedelic_enable_->setCheckable(true);

  context_menu_->addSeparator();
  // Visualisation action gets added in SetActions

  double_click_timer_->setSingleShot(true);
  double_click_timer_->setInterval(250);
  connect(double_click_timer_, SIGNAL(timeout()), SLOT(ShowPopupMenu()));

  Load();
}
Beispiel #5
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
    static const UINT WM_TASKBARCREATED = ::RegisterWindowMessage(L"TaskbarCreated");
    int nID;
    switch (message) {
        case WM_TASKBARNOTIFY:
            if (lParam == WM_LBUTTONUP) {
                ShowWindow(hConsole, !IsWindowVisible(hConsole));
                SetForegroundWindow(hConsole);
            } else if (lParam == WM_RBUTTONUP) {
                SetForegroundWindow(hWnd);
                ShowPopupMenu();
            }
            break;
        case WM_COMMAND:
            nID = LOWORD(wParam);
            if (nID == WM_TASKBARNOTIFY_MENUITEM_SHOW) {
                ShowWindow(hConsole, SW_SHOW);
                SetForegroundWindow(hConsole);
            } else if (nID == WM_TASKBARNOTIFY_MENUITEM_HIDE) {
                ShowWindow(hConsole, SW_HIDE);
            }
            if (nID == WM_TASKBARNOTIFY_MENUITEM_RELOAD) {
                ReloadCmdline(szSubTitleLast, szSubPathLast, szSubCommandLast);
            } else if (nID == WM_TASKBARNOTIFY_MENUITEM_ABOUT) {
                MessageBoxW(hWnd, szTooltip, szWindowClass, 0);
            } else if (nID == WM_TASKBARNOTIFY_MENUITEM_EXIT) {
                DeleteTrayIcon();
                PostMessage(hConsole, WM_CLOSE, 0, 0);
            } else if (WM_TASKBARNOTIFY_MENUITEM_SUBMENULIST_BASE <= nID && nID <= WM_TASKBARNOTIFY_MENUITEM_SUBMENULIST_BASE+sizeof(lpSubMenuTitleList)/sizeof(lpSubMenuTitleList[0])) {
                WCHAR *szSubMenu = lpSubMenuTitleList[nID-WM_TASKBARNOTIFY_MENUITEM_SUBMENULIST_BASE];
                WCHAR *szSubCmd = lpSubMenuCmdList[nID-WM_TASKBARNOTIFY_MENUITEM_SUBMENULIST_BASE];
                WCHAR *szSubPath = lpSubMenuPathList[nID-WM_TASKBARNOTIFY_MENUITEM_SUBMENULIST_BASE];
                ReloadCmdline(szSubMenu, szSubPath, szSubCmd);
                ShowTrayIcon(szSubMenu, NIM_MODIFY);
            }
            break;
        case WM_CLOSE:
            DeleteTrayIcon();
            PostQuitMessage(0);
            break;
        case WM_DESTROY:
            PostQuitMessage(0);
            break;
        default:
            if (message == WM_TASKBARCREATED) {
                ShowTrayIcon(NULL, NIM_ADD);
                break;
            }
            return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
Beispiel #6
0
int UVViewWindow::handle (int msg)
{
	int r = ViewWindow::handle (msg);

	if (msg == fltk::PUSH) {
		if (fltk::event_button () == 3) {
			ShowPopupMenu ();
			return -1;
		}
	}

	return r;
}
bool CViewProps::OnButtonFile(CButton* Button, CPLPropertyEditEx *Prop, CPLCategory *Cat)
{
	CPLProperty* prop = m_PropList.GetProperty(m_PropList.GetCurSel());
	if(!prop) return false;

	if(prop->GetValue()=="") OnPopupFileBrowse();
	else{
		RECT rc;
		Button->GetWindowRect(&rc);
		ShowPopupMenu(IDR_POPUP_FILE, IDR_POPUP_FILE, &rc);
	}
	return false;
}
// This is to make context menus work properly--there is a quirk in 
// CTreeView where you have to double-right click for context menus
// to work.
void CPrefEditView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) 
{
	CTreeCtrl & treeCtrl = GetTreeCtrl();

	// Get the cursor position for this message 
	DWORD dwPos = GetMessagePos();

	// Convert the coords into a CPoint structure 
	CPoint pt(LOWORD( dwPos ), HIWORD( dwPos ));
	CPoint spt;

	spt = pt;

	// convert to screen coords for the hittesting to work 
	treeCtrl.ScreenToClient( &spt );

	UINT test;
	HTREEITEM hTreeCtrlItem = treeCtrl.HitTest(spt, &test);

	if (hTreeCtrlItem != NULL)
	{
		// Is the click actually *on* the item? 
		if (test & TVHT_ONITEM)
		{
      // Select the item.
      treeCtrl.SelectItem(hTreeCtrlItem);

      int submenu;
      if (!treeCtrl.ItemHasChildren(hTreeCtrlItem)) // no children == leaf node == pref 
      {
        CPrefElement* pe = (CPrefElement*)treeCtrl.GetItemData(hTreeCtrlItem);
        ASSERT(pe); // there must be a CPrefElement object for each leaf node.
        if (!pe)
          return;

        if (pe->IsUserAdded())
          submenu = menu_userAddedPref;
        else
          submenu = menu_pref;
      }
      else
      {
        submenu = menu_group;
      }

      ShowPopupMenu(pt, submenu);
		}
	}
	
	*pResult = 0;
}
Beispiel #9
0
///////////////////////////////////////////////////////////////////////////////
// Create and display a popup menu when the user right-clicks on the icon
int OnTrayIcon(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(wParam);

	if(g_modalShown == TRUE)
		return 0;

	switch(lParam)
	{
	case WM_RBUTTONUP:
		// Show the context menu
		ShowPopupMenu(hWnd);
		return 0;
	}
	return 0;
}
Beispiel #10
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int nID;
	switch (message) 
	{
		case WM_TASKBARNOTIFY:
			if (lParam == WM_LBUTTONUP)
			{
				ShowWindow(hConsole, !IsWindowVisible(hConsole));
				SetForegroundWindow(hConsole);
			}
			else if (lParam == WM_RBUTTONUP)
			{
				ShowPopupMenu();
			}
			break;
		case WM_COMMAND:
			nID = LOWORD(wParam);
			if (nID == WM_TASKBARNOTIFY_MENUITEM_SHOW)
			{
				ShowWindow(hConsole, SW_SHOW);
				SetForegroundWindow(hConsole);
			}
			else if (nID == WM_TASKBARNOTIFY_MENUITEM_HIDE)
			{
				ShowWindow(hConsole, SW_HIDE);
			}
			else if (nID == WM_TASKBARNOTIFY_MENUITEM_EXIT)
			{
				DeleteTrayIcon();
				PostMessage(hConsole, WM_CLOSE, 0, 0);
			}
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
Beispiel #11
0
/*
  FLTK event handler
 */
int EditorViewWindow::handle (int msg)
{
	if (msg == fltk::DRAG)
	{
		if (!bBoxSelect) {
			Tool *tool = editor->GetTool();
			if(tool) 
				tool->mouse (this, fltk::DRAG, Point (fltk::event_x() - last.x, fltk::event_y () - last.y));
		}
	}

	int r = ViewWindow::handle (msg);

	if (msg == fltk::PUSH) {
		if (click.x < PopupBoxW && click.y < PopupBoxH) {
			ShowPopupMenu ();
			return -1;
		}
	}

	return r;
}
Beispiel #12
0
    BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT& theResult, DWORD dwMapId)
    {
        theResult = 0;
        switch (Msg)
        {
        case WM_CREATE:
            if (!InitControls())
                ::PostMessage(hwnd, WM_CLOSE, 0, 0);
            break;

        case WM_DESTROY:
        {
            ShowWindow(SW_HIDE);
            SaveSettings(hwnd);

            FreeLogs();

            FreeCachedAvailableEntries();

            if (IS_INSTALLED_ENUM(SelectedEnumType))
                FreeInstalledAppList();

            if (hImageTreeView)
                ImageList_Destroy(hImageTreeView);

            delete m_ClientPanel;

            PostQuitMessage(0);
            return 0;
        }

        case WM_COMMAND:
            OnCommand(wParam, lParam);
            break;

        case WM_NOTIFY:
        {
            LPNMHDR data = (LPNMHDR) lParam;

            switch (data->code)
            {
            case TVN_SELCHANGED:
            {
                if (data->hwndFrom == m_TreeView->m_hWnd)
                {
                    switch (((LPNMTREEVIEW) lParam)->itemNew.lParam)
                    {
                    case IDS_INSTALLED:
                        UpdateApplicationsList(ENUM_ALL_COMPONENTS);
                        break;

                    case IDS_APPLICATIONS:
                        UpdateApplicationsList(ENUM_APPLICATIONS);
                        break;

                    case IDS_UPDATES:
                        UpdateApplicationsList(ENUM_UPDATES);
                        break;

                    case IDS_AVAILABLEFORINST:
                        UpdateApplicationsList(ENUM_ALL_AVAILABLE);
                        break;

                    case IDS_CAT_AUDIO:
                        UpdateApplicationsList(ENUM_CAT_AUDIO);
                        break;

                    case IDS_CAT_DEVEL:
                        UpdateApplicationsList(ENUM_CAT_DEVEL);
                        break;

                    case IDS_CAT_DRIVERS:
                        UpdateApplicationsList(ENUM_CAT_DRIVERS);
                        break;

                    case IDS_CAT_EDU:
                        UpdateApplicationsList(ENUM_CAT_EDU);
                        break;

                    case IDS_CAT_ENGINEER:
                        UpdateApplicationsList(ENUM_CAT_ENGINEER);
                        break;

                    case IDS_CAT_FINANCE:
                        UpdateApplicationsList(ENUM_CAT_FINANCE);
                        break;

                    case IDS_CAT_GAMES:
                        UpdateApplicationsList(ENUM_CAT_GAMES);
                        break;

                    case IDS_CAT_GRAPHICS:
                        UpdateApplicationsList(ENUM_CAT_GRAPHICS);
                        break;

                    case IDS_CAT_INTERNET:
                        UpdateApplicationsList(ENUM_CAT_INTERNET);
                        break;

                    case IDS_CAT_LIBS:
                        UpdateApplicationsList(ENUM_CAT_LIBS);
                        break;

                    case IDS_CAT_OFFICE:
                        UpdateApplicationsList(ENUM_CAT_OFFICE);
                        break;

                    case IDS_CAT_OTHER:
                        UpdateApplicationsList(ENUM_CAT_OTHER);
                        break;

                    case IDS_CAT_SCIENCE:
                        UpdateApplicationsList(ENUM_CAT_SCIENCE);
                        break;

                    case IDS_CAT_TOOLS:
                        UpdateApplicationsList(ENUM_CAT_TOOLS);
                        break;

                    case IDS_CAT_VIDEO:
                        UpdateApplicationsList(ENUM_CAT_VIDEO);
                        break;
                    }
                }

                HMENU mainMenu = ::GetMenu(hwnd);
                HMENU lvwMenu = ::GetMenu(m_ListView->m_hWnd);

                /* Disable/enable items based on treeview selection */
                if (IsSelectedNodeInstalled())
                {
                    EnableMenuItem(mainMenu, ID_REGREMOVE, MF_ENABLED);
                    EnableMenuItem(mainMenu, ID_INSTALL, MF_GRAYED);
                    EnableMenuItem(mainMenu, ID_UNINSTALL, MF_ENABLED);
                    EnableMenuItem(mainMenu, ID_MODIFY, MF_ENABLED);

                    EnableMenuItem(lvwMenu, ID_REGREMOVE, MF_ENABLED);
                    EnableMenuItem(lvwMenu, ID_INSTALL, MF_GRAYED);
                    EnableMenuItem(lvwMenu, ID_UNINSTALL, MF_ENABLED);
                    EnableMenuItem(lvwMenu, ID_MODIFY, MF_ENABLED);

                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_INSTALL, FALSE);
                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_MODIFY, TRUE);
                }
                else
                {
                    EnableMenuItem(mainMenu, ID_REGREMOVE, MF_GRAYED);
                    EnableMenuItem(mainMenu, ID_INSTALL, MF_ENABLED);
                    EnableMenuItem(mainMenu, ID_UNINSTALL, MF_GRAYED);
                    EnableMenuItem(mainMenu, ID_MODIFY, MF_GRAYED);

                    EnableMenuItem(lvwMenu, ID_REGREMOVE, MF_GRAYED);
                    EnableMenuItem(lvwMenu, ID_INSTALL, MF_ENABLED);
                    EnableMenuItem(lvwMenu, ID_UNINSTALL, MF_GRAYED);
                    EnableMenuItem(lvwMenu, ID_MODIFY, MF_GRAYED);

                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_REGREMOVE, FALSE);
                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_INSTALL, TRUE);
                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_UNINSTALL, FALSE);
                    m_Toolbar->SendMessage(TB_ENABLEBUTTON, ID_MODIFY, FALSE);
                }
            }
            break;

            case LVN_ITEMCHANGED:
            {
                LPNMLISTVIEW pnic = (LPNMLISTVIEW) lParam;

                if (pnic->hdr.hwndFrom == m_ListView->m_hWnd)
                {
                    /* Check if this is a valid item
                    * (technically, it can be also an unselect) */
                    INT ItemIndex = pnic->iItem;
                    if (ItemIndex == -1 ||
                        ItemIndex >= ListView_GetItemCount(pnic->hdr.hwndFrom))
                    {
                        break;
                    }

                    /* Check if the focus has been moved to another item */
                    if ((pnic->uChanged & LVIF_STATE) &&
                        (pnic->uNewState & LVIS_FOCUSED) &&
                        !(pnic->uOldState & LVIS_FOCUSED))
                    {
                        if (IS_INSTALLED_ENUM(SelectedEnumType))
                            ShowInstalledAppInfo(ItemIndex);
                        if (IS_AVAILABLE_ENUM(SelectedEnumType))
                            ShowAvailableAppInfo(ItemIndex);
                    }
                }
            }
            break;

            case LVN_COLUMNCLICK:
            {
                LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;

                m_ListView->ColumnClick(pnmv);
            }
            break;

            case NM_CLICK:
            {
                if (data->hwndFrom == m_ListView->m_hWnd && ((LPNMLISTVIEW) lParam)->iItem != -1)
                {
                    if (IS_INSTALLED_ENUM(SelectedEnumType))
                        ShowInstalledAppInfo(-1);
                    if (IS_AVAILABLE_ENUM(SelectedEnumType))
                        ShowAvailableAppInfo(-1);
                }
            }
            break;

            case NM_DBLCLK:
            {
                if (data->hwndFrom == m_ListView->m_hWnd && ((LPNMLISTVIEW) lParam)->iItem != -1)
                {
                    /* this won't do anything if the program is already installed */
                    SendMessage(hwnd, WM_COMMAND, ID_INSTALL, 0);
                }
            }
            break;

            case NM_RCLICK:
            {
                if (data->hwndFrom == m_ListView->m_hWnd && ((LPNMLISTVIEW) lParam)->iItem != -1)
                {
                    ShowPopupMenu(m_ListView->m_hWnd, 0, ID_INSTALL);
                }
            }
            break;

            case EN_LINK:
                OnLink((ENLINK*) lParam);
                break;

            case TTN_GETDISPINFO:
                m_Toolbar->OnGetDispInfo((LPTOOLTIPTEXT) lParam);
                break;
            }
        }
        break;

        case WM_SIZE:
            OnSize(hwnd, wParam, lParam);
            break;

        case WM_SIZING:
        {
            LPRECT pRect = (LPRECT) lParam;

            if (pRect->right - pRect->left < 565)
                pRect->right = pRect->left + 565;

            if (pRect->bottom - pRect->top < 300)
                pRect->bottom = pRect->top + 300;

            return TRUE;
        }

        case WM_SYSCOLORCHANGE:
        {
            /* Forward WM_SYSCOLORCHANGE to common controls */
            m_ListView->SendMessage(WM_SYSCOLORCHANGE, 0, 0);
            m_TreeView->SendMessage(WM_SYSCOLORCHANGE, 0, 0);
            m_Toolbar->SendMessage(WM_SYSCOLORCHANGE, 0, 0);
            m_ListView->SendMessage(EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_BTNFACE));
        }
        break;

        case WM_TIMER:
            if (wParam == SEARCH_TIMER_ID)
            {
                ::KillTimer(hwnd, SEARCH_TIMER_ID);
                UpdateApplicationsList(-1);
            }
            break;
        }

        return FALSE;
    }
Beispiel #13
0
BOOL CMenuItem::OnControlMouseMove(UINT nFlags, CPoint point)
{
	enumButtonState buttonState = m_enButtonState;
	if (!m_bIsDisable && !m_bMouseDown)
	{
		if(m_rc.PtInRect(point))
		{
			if(m_bSelect)
			{
				if(m_bDown)
				{
					m_enButtonState = enBSHoverDown;
				}
				else
				{
					m_enButtonState = enBSHover;
				}
			}
			else
			{
				m_enButtonState = enBSHover;
				// 如果有子菜单,则加载弹出菜单
				if(m_bIsPopup)
				{
					ShowPopupMenu();
				}
			}
		}
		else
		{
			// 如果存在弹出菜单,并且鼠标不在弹出菜单范围内,则关闭弹出菜单
			if(m_bIsPopup && (m_pPopupMenu != NULL))
			{
				// 检查父菜单的各个子菜单,看鼠标当前是否在其他菜单项上面
				CDuiMenu* pParentMenu = GetParentMenu();
				//CMenuItem* pHoverItem = pParentMenu->GetHoverMenuItem();
				CMenuItem* pHoverItem = pParentMenu->GetMenuItemWithPoint(point);
				if((pHoverItem != NULL) && (pHoverItem != this))
				{
					// 如果鼠标在其他平级的菜单上,则关闭子菜单
					if(IsWindow(m_pPopupMenu->GetSafeHwnd()))
					{
						m_pPopupMenu->CloseWindow();
					}
					m_pPopupMenu = NULL;
				
					// 父菜单对象设置回自动关闭
					CDuiMenu* pParentMenu = GetParentMenu();
					if(pParentMenu)
					{
						pParentMenu->SetAutoClose(TRUE);
						pParentMenu->SetForegroundWindow();
					}
				}
			}

			if(m_bSelect)
			{
				if(m_bDown)
				{
					m_enButtonState = enBSDown;
				}
				else
				{
					m_enButtonState = enBSNormal;
				}
			}
			else
			{
				m_enButtonState = enBSNormal;
			}
		}
	}
	
	if(buttonState != m_enButtonState)
	{
		UpdateControl();
		return true;
	}
	return false;
}
Beispiel #14
0
// 'Main program' equivalent: the program execution "starts" here
bool CocoaDialogApp::OnInit()
{	
	if (utf8_args.GetCount() < 2)
		return OptionError();

	m_parentWnd = NULL;
	// This code is currently disabled, as it will end up
    // setting focus to a random window if parentwnd is busy.
	// http://blogs.msdn.com/oldnewthing/archive/2004/02/27/81155.aspx
#ifdef __WXMSW__
	// Use currently active window as parent
	HWND wnd = ::GetForegroundWindow();
	if (wnd) {
		m_parentWnd = new wxWindow();
		m_parentWnd->AssociateHandle(wnd);
	}
#endif //__WXMSW__
	
	// Parse the options
	const wxString runmode(utf8_args[1]);
	m_optionDict.SetRunmode(runmode);
	if (!m_optionDict.ParseArgs(utf8_args)) return OptionError();

//	m_optionDict.Print();

	//Initilizing image handlers
	//wxImage::AddHandler(new wxBMPHandler);
	wxImage::AddHandler(new wxPNGHandler);
	wxImage::AddHandler(new wxJPEGHandler);
	wxImage::AddHandler(new wxGIFHandler);
	wxImage::AddHandler(new wxICOHandler);

	// Show the Dialog
	if (runmode == wxT("inputbox")) {
		// Verify mandatory options
		if (!m_optionDict.HasOption(wxT("button1"))) return OptionError(wxT("At least one button has to be defined"));
		
		InputBox* inputBox = new InputBox(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
		SetTopWindow(inputBox);
	}
	else if (runmode == wxT("secure-inputbox")) {
		// Verify mandatory options
		if (!m_optionDict.HasOption(wxT("button1"))) return OptionError(wxT("At least one button has to be defined"));
		
		m_optionDict.SetOption(wxT("no-show"));
		
		new InputBox(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("standard-inputbox")) {
		m_optionDict.SetOption(wxT("button1"), wxT("Ok"));
		if (!m_optionDict.HasOption(wxT("no-cancel"))) m_optionDict.SetOption(wxT("button2"), wxT("Cancel"));

		new InputBox(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("secure-standard-inputbox")) {
		m_optionDict.SetOption(wxT("button1"), wxT("Ok"));
		if (!m_optionDict.HasOption(wxT("no-cancel"))) m_optionDict.SetOption(wxT("button2"), wxT("Cancel"));

		m_optionDict.SetOption(wxT("no-show"));

		new InputBox(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("progressbar")) {
		new ProgressBar(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("dropdown")) {
		// Verify mandatory options
		if (!m_optionDict.HasOption(wxT("button1"))) return OptionError(wxT("At least one button has to be defined."));
		if (!m_optionDict.HasMultiOption(wxT("items"))) return OptionError(wxT("Need to define items for dropdown box."));

		new DropdownBox(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("standard-dropdown")) {
		m_optionDict.SetOption(wxT("button1"), wxT("Ok"));
		m_optionDict.SetOption(wxT("button2"), wxT("Cancel"));
		// Verify mandatory options
		if (!m_optionDict.HasMultiOption(wxT("items"))) return OptionError(wxT("Need to define items for dropdown box."));

		new DropdownBox(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("msgbox")) {
		if (m_optionDict.HasOption(wxT("help"))) return OptionHelp(wxT("msgbox"));
		// Verify mandatory options
		if (!m_optionDict.HasOption(wxT("button1"))) return OptionError(wxT("At least one button has to be defined"));
		
		new MessageDialog(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("ok-msgbox")) {
		if (m_optionDict.HasOption(wxT("help"))) return OptionHelp(wxT("ok-msgbox"));
		m_optionDict.SetOption(wxT("button1"), wxT("Ok"));
		if (!m_optionDict.HasOption(wxT("no-cancel"))) m_optionDict.SetOption(wxT("button2"), wxT("Cancel"));
		
		new MessageDialog(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("yesno-msgbox")) {
		if (m_optionDict.HasOption(wxT("help"))) return OptionHelp(wxT("yesno-msgbox"));
		m_optionDict.SetOption(wxT("button1"), wxT("Yes"));
		m_optionDict.SetOption(wxT("button2"), wxT("No"));
		
		new MessageDialog(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("textbox")) {
		if (m_optionDict.HasOption(wxT("help"))) return OptionHelp(wxT("textbox"));
		// Verify mandatory options
		if (!m_optionDict.HasOption(wxT("button1"))) return OptionError(wxT("At least one button has to be defined"));
		
		new InputBox(m_parentWnd, m_optionDict, m_optionDict.HasOption(wxT("float")));
	}
	else if (runmode == wxT("fileselect") || runmode == wxT("filesave")) {
		ShowFileDialog();
		return false; // end program
	}
	else if (runmode == wxT("colourselect") || runmode == wxT("colorselect")) {
		ShowColourDialog();
		return false; // end program
	}
	else if (runmode == wxT("menu")) {
		ShowPopupMenu();
		return false; // end program
	}
#ifdef FEAT_BROWSER
	else if (runmode == wxT("html")) {
		new HtmlDialog(m_parentWnd, m_optionDict);
	}
#endif
	else return OptionError(wxT("Unknown runmode."));

	wxLogDebug(wxT("wxCD done"));

	return true;
}
void VisualisationContainer::contextMenuEvent(QContextMenuEvent* event) {
  QGraphicsView::contextMenuEvent(event);
  ShowPopupMenu(event->pos());
}
//-------------------------------------------------------------------------
INT_PTR CALLBACK ResetPermissionDialog::MainDialogProc(
    HWND hWnd,
    UINT message,
    WPARAM wParam,
    LPARAM lParam)
{
    switch (message)
    {
        case WM_INITDIALOG:
        {
            hDlg = hWnd;

            // Set the initial states/configuration
            bRecurse = true;
            bResetPerm = true;
            bRmHidSys = false;
            bTakeOwn = false;
            bDontFollowLinks = true;

            UpdateCheckboxes(false);

            HICON hIcon = LoadIcon(
                hInstance,
                MAKEINTRESOURCE(IDI_SMALL));

            SendMessage(
                hDlg,
                WM_SETICON,
                ICON_BIG,
                (LPARAM)hIcon);

            LPCTSTR Arg = GetArg(1);

    #ifdef _DEBUG
            if (Arg == NULL)
                Arg = _TEXT("C:\\Temp\\perm");

			// Enable editing for the folder text editbox in debug mode
            SendDlgItemMessage(hDlg, IDTXT_FOLDER, EM_SETREADONLY, FALSE, 0);
    #endif

            if (Arg != NULL)
            {
                SetFolderText(Arg);
                UpdateCommandText();
            }

            return TRUE;
        }

        case WM_MENUCOMMAND:
            break;

        case WM_COMMAND:
        {
            UINT wmId = LOWORD(wParam);
            UINT wmEvent = HIWORD(wParam);
    #ifdef _DEBUG
            TCHAR b[1024];
            _sntprintf_s(
                b,
                _countof(b),
                _TEXT("WM_COMMAND: wmParam=%08X lParam=%08X | ID=%04X Event=%04X\n"),
                wParam,
                lParam,
                wmId,
                wmEvent);
            OutputDebugString(b);
			
			// Reflect the folder text changes when the control is editable
            if (wmId == IDTXT_FOLDER && wmEvent == EN_CHANGE)
                UpdateCommandText();
    #endif
            switch (wmId)
            {
                //
                // Handle checkboxes
                //
                case IDCHK_RECURSE:
                case IDCHK_DONTFOLLOWLINKS:
                case IDCHK_TAKEOWN:
                case IDCHK_RESETPERM:
                case IDCHK_RM_HS:
                {
                    // Reforumulate the command text on each option change
                    if (wmEvent == BN_CLICKED)
                    {
                        UpdateCommandText();
                        return TRUE;
                    }
                    break;
                }

                //
                // Handle context menu
                //
                case IDM_ADDTOEXPLORERFOLDERCONTEXTMENU:
                case IDM_REMOVEFROMEXPLORERFOLDERCONTEXTMENU:
                    AddToExplorerContextMenu(wmId == IDM_ADDTOEXPLORERFOLDERCONTEXTMENU);
                    break;

                case IDM_BACKUPPERMSCONTEXTMENU:
                case IDM_RESTOREPERMSCONTEXTMENU:
                    BackRestorePermissions(wmId == IDM_BACKUPPERMSCONTEXTMENU);
                    break;

                //
                // About box
                //
                case IDBTN_ABOUT:
                {
                    DialogBox(
                        hInstance,
                        MAKEINTRESOURCE(IDD_ABOUTBOX),
                        hDlg,
                        AboutDlgProc);

                    return TRUE;
                }

                //
                // Choose folder
                //
                case IDBTN_CHOOSE_FOLDER:
                {
                    stringT Folder;
                    if (BrowseFolder(hDlg, STR_SELECT_FOLDER, Folder))
                    {
                        SetFolderText(Folder.c_str());
                        UpdateCommandText();
                    }
                    return TRUE;
                }

                //
                // Trigger the "Advanced" menu
                //
                case IDBTN_ADVANCED:
                {
                    ShowPopupMenu(IDR_ADVANCED_MENU, IDBTN_ADVANCED);
                    return TRUE;
                }

                //
                // GO button
                //
                case IDOK:
                {
                    // Validate the input folder and execute the command
                    ExecuteWindowCommand(true);
                    return TRUE;
                }

                // HELP button
                case IDBTN_HELP:
                {
                    ShellExecute(
                        hDlg,
                        _TEXT("open"),
                        STR_HELP_URL,
                        nullptr,
                        nullptr,
                        SW_SHOW);

                    return TRUE;
                }
            } // switch(wmId)
            break;
        } // case WM_COMMAND

        // Close dialog
        case WM_CLOSE:
            EndDialog(hDlg, IDOK);
            return TRUE;
    }
    return FALSE;
}
Beispiel #17
0
void Editor::UpdateInput()
{
	GHScreen::UpdateInput();

	// check for main menu
	if(TestControl(dBCtrl_Edit_Menu, GHCT_Once))
		gMenu.Push();

	if(TestControl(dBCtrl_Edit_PopupMenu, GHCT_Once))
		ShowPopupMenu();

	// check for section jump
	if(TestControl(dBCtrl_Edit_Goto, GHCT_Once))
		gpStringBox->Show(MFTranslation_GetString(pStrings, MENU_GOTO), "", GotoSection);

	// update the editor.
	UpdateEditor();

	// enable/disable half time
	if(TestControl(dBCtrl_Edit_PlaybackRate, GHCT_Once))
	{
		bHalfSpeed.data = (bHalfSpeed.data + 1) % (int)(sizeof(gSpeeds) / sizeof(gSpeeds[0]));

		if(gEditor.pSong->pStream)
			MFSound_SetPlaybackRate(MFSound_GetStreamVoice(gEditor.pSong->pStream), gSpeeds[bHalfSpeed]);
		if(gEditor.pSong->pGuitar)
			MFSound_SetPlaybackRate(MFSound_GetStreamVoice(gEditor.pSong->pGuitar), gSpeeds[bHalfSpeed]);
		if(gEditor.pSong->pBass)
			MFSound_SetPlaybackRate(MFSound_GetStreamVoice(gEditor.pSong->pBass), gSpeeds[bHalfSpeed]);
	}

	// swap modes
	if(TestControl(dBCtrl_Edit_StartPlayback, GHCT_Once) || TestControl(dBCtrl_Edit_RestartPlayback, GHCT_Once))
	{
		gEditor.state = GHPS_Playing;

		gEditor.pSong->CalculateNoteTimes(gEditor.currentStream[0], 0);
		if(gEditor.currentStream[1] != -1)
			gEditor.pSong->CalculateNoteTimes(gEditor.currentStream[1], 0);

		if(TestControl(dBCtrl_Edit_RestartPlayback, GHCT_Once))
		{
			gEditor.playbackStartOffset = 0;
			gEditor.playingTime = 0;
		}
		else
		{
			gEditor.playbackStartOffset = gEditor.offset;
			gEditor.playingTime = gEditor.pSong->CalculateTimeOfTick(gEditor.offset);
		}

		gEditor.pSong->Play(gEditor.playingTime);

		gPlay.scoreKeeper[0].Begin(gEditor.pSong, (GHStreams)gEditor.currentStream[0], 0, gEditor.playingTime);
		if(gEditor.currentStream[1] != -1)
			gPlay.scoreKeeper[1].Begin(gEditor.pSong, (GHStreams)gEditor.currentStream[1], 1, gEditor.playingTime);

		if(gEditor.pSong->pStream || gEditor.pSong->pGuitar || gEditor.pSong->pBass)
		{
			gEditor.playStart = 0;
			gEditor.lastTimestamp = 0;
		}
		else
		{
			gEditor.playStart = MFSystem_ReadRTC();
		}
		gEditor.startTime = gEditor.playingTime;

		bSelecting = false;

		Pop();
		gPlay.Push();
	}
}
Beispiel #18
0
// Show the contextual menu (shortcut menu) for an XY Chart
int		CXYChart::ShowPopupMenu( CWnd *window, UINT nFlags, CPoint point )
{
	return ShowPopupMenu( NULL, window, nFlags, point );
}
Beispiel #19
0
long SciDoc::onRightBtnPress(FXObject *o, FXSelector sel, void *p)
{
  FXEvent* ev=(FXEvent*)p;
  ShowPopupMenu(ev->root_x-4,ev->root_y-2);
  return 1;
}
Beispiel #20
0
	static LRESULT CALLBACK WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		static UINT s_uTaskbarRestart;

		switch (uMsg)
		{
			case WM_CREATE:
			{
				s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
				AddTrayIcon (hWnd);
				break;
			}
			case WM_CLOSE:
			{
				RemoveTrayIcon (hWnd);
				KillTimer (hWnd, FRAME_UPDATE_TIMER);
				KillTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER);
				KillTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER);
				PostQuitMessage (0);
				break;
			}
			case WM_COMMAND:
			{
				switch (LOWORD(wParam))
				{
					case ID_ABOUT:
					{
						std::stringstream text;
						text << "Version: " << I2PD_VERSION << " " << CODENAME;
						MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
						return 0;
					}
					case ID_EXIT:
					{
						PostMessage (hWnd, WM_CLOSE, 0, 0);
						return 0;
					}
					case ID_ACCEPT_TRANSIT:
					{
						i2p::context.SetAcceptsTunnels (true);
						std::stringstream text;
						text << "I2Pd now accept transit tunnels";
						MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
						return 0;
					}
					case ID_DECLINE_TRANSIT:
					{
						i2p::context.SetAcceptsTunnels (false);
						std::stringstream text;
						text << "I2Pd now decline new transit tunnels";
						MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
						return 0;
					}
					case ID_GRACEFUL_SHUTDOWN:
					{
						i2p::context.SetAcceptsTunnels (false);
						SetTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER, 10*60*1000, nullptr); // 10 minutes
						SetTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER, 1000, nullptr); // check tunnels every second
						GracefulShutdownEndtime = GetTickCount() + 10*60*1000;
						i2p::util::DaemonWin32::Instance ().isGraceful = true;
						return 0;
					}
					case ID_STOP_GRACEFUL_SHUTDOWN:
					{
						i2p::context.SetAcceptsTunnels (true);
						KillTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER);
						KillTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER);
						GracefulShutdownEndtime = 0;
						i2p::util::DaemonWin32::Instance ().isGraceful = false;
						return 0;
					}
					case ID_RELOAD:
					{
						i2p::client::context.ReloadConfig();
						std::stringstream text;
						text << "I2Pd reloading configs...";
						MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
						return 0;
					}
					case ID_CONSOLE:
					{
						char buf[30];
						std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
						uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
						snprintf(buf, 30, "http://%s:%d", httpAddr.c_str(), httpPort);
						ShellExecute(NULL, "open", buf, NULL, NULL, SW_SHOWNORMAL);
						return 0;
					}
					case ID_APP:
					{
						ShowWindow(hWnd, SW_SHOW);
						SetTimer(hWnd, FRAME_UPDATE_TIMER, 3000, NULL);
						return 0;
					}
				}
				break;
			}
			case WM_SYSCOMMAND:
			{
				switch (wParam)
				{
					case SC_MINIMIZE:
					{
						ShowWindow(hWnd, SW_HIDE);
						KillTimer (hWnd, FRAME_UPDATE_TIMER);
						return 0;
					}
					case SC_CLOSE:
					{
						std::string close; i2p::config::GetOption("close", close);
						if (0 == close.compare("ask"))
						switch(::MessageBox(hWnd, "Would you like to minimize instead of exiting?"
						" You can add 'close' configuration option. Valid values are: ask, minimize, exit.",
						"Minimize instead of exiting?", MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON1))
						{
							case IDYES: close = "minimize"; break;
							case IDNO: close = "exit"; break;
							default: return 0;
						}
						if (0 == close.compare("minimize"))
						{
							ShowWindow(hWnd, SW_HIDE);
							KillTimer (hWnd, FRAME_UPDATE_TIMER);
							return 0;
						}
						if (0 != close.compare("exit"))
						{
							::MessageBox(hWnd, close.c_str(), "Unknown close action in config", MB_OK | MB_ICONWARNING);
							return 0;
						}
					}
				}
			}
			case WM_TRAYICON:
			{
				switch (lParam)
				{
					case WM_LBUTTONUP:
					case WM_RBUTTONUP:
					{
						SetForegroundWindow (hWnd);
						ShowPopupMenu(hWnd, NULL, -1);
						PostMessage (hWnd, WM_APP + 1, 0, 0);
						break;
					}
				}
				break;
			}
			case WM_TIMER:
			{
				switch(wParam)
				{
					case IDT_GRACEFUL_SHUTDOWN_TIMER:
					{
						GracefulShutdownEndtime = 0;
						PostMessage (hWnd, WM_CLOSE, 0, 0); // exit
						return 0;
					}
					case FRAME_UPDATE_TIMER:
					{
						InvalidateRect(hWnd, NULL, TRUE);
						return 0;
					}
					case IDT_GRACEFUL_TUNNELCHECK_TIMER:
					{
						if (i2p::tunnel::tunnels.CountTransitTunnels() == 0)
							PostMessage (hWnd, WM_CLOSE, 0, 0);
						else
							SetTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER, 1000, nullptr);
						return 0;
					}
				}
				break;
			}
			case WM_PAINT:
			{
				HDC hDC;
				PAINTSTRUCT ps;
				RECT rp;
				HFONT hFont;
				std::stringstream s; PrintMainWindowText (s);
				hDC = BeginPaint (hWnd, &ps);
				GetClientRect(hWnd, &rp);
				SetTextColor(hDC, 0x00D43B69);
				hFont = CreateFont(18,0,0,0,0,0,0,0,DEFAULT_CHARSET,0,0,0,0,TEXT("Times New Roman"));
				SelectObject(hDC,hFont);
				DrawText(hDC, TEXT(s.str().c_str()), s.str().length(), &rp, DT_CENTER|DT_VCENTER);
				DeleteObject(hFont);
				EndPaint(hWnd, &ps);
				break;
			}
			default:
			{
				if (uMsg == s_uTaskbarRestart)
					AddTrayIcon (hWnd);
				break;
			}
		}
		return DefWindowProc( hWnd, uMsg, wParam, lParam);
	}
Beispiel #21
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static UINT WM_TASKBARCREATED = 0;
    if (WM_TASKBARCREATED == 0)
        WM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");

    UINT nID;
    switch (message)
    {
        case WM_TASKBARNOTIFY:
            if (lParam == WM_LBUTTONUP)
            {
                ShowWindow(hConsole, !IsWindowVisible(hConsole));
                SetForegroundWindow(hConsole);
            }
            else if (lParam == WM_RBUTTONUP)
            {
                SetForegroundWindow(hWnd);
                ShowPopupMenu();
            }
            break;
        case WM_COMMAND:
            nID = LOWORD(wParam);
            if (nID == WM_TASKBARNOTIFY_MENUITEM_SHOW)
            {
                ShowWindow(hConsole, SW_SHOW);
                SetForegroundWindow(hConsole);
            }
            else if (nID == WM_TASKBARNOTIFY_MENUITEM_HIDE)
            {
                ShowWindow(hConsole, SW_HIDE);
            }
            if (nID == WM_TASKBARNOTIFY_MENUITEM_RELOAD)
            {
                ReloadCmdline();
            }
            else if (nID == WM_TASKBARNOTIFY_MENUITEM_ABOUT)
            {
                MessageBoxW(hWnd, szTooltip, szWindowClass, 0);
            }
            else if (nID == WM_TASKBARNOTIFY_MENUITEM_EXIT)
            {
                DeleteTrayIcon();
                PostMessage(hConsole, WM_CLOSE, 0, 0);
            }
            else if (WM_TASKBARNOTIFY_MENUITEM_PROXYLIST_BASE <= nID && nID <= WM_TASKBARNOTIFY_MENUITEM_PROXYLIST_BASE+sizeof(lpProxyList)/sizeof(lpProxyList[0]))
            {
                WCHAR *szProxy = lpProxyList[nID-WM_TASKBARNOTIFY_MENUITEM_PROXYLIST_BASE];
                SetWindowsProxy(szProxy, NULL);
                SetWindowsProxyForAllRasConnections(szProxy);
                ShowTrayIcon(szProxy, NIM_MODIFY);
            }
            break;
        case WM_CLOSE:
            DeleteTrayIcon();
            PostQuitMessage(0);
            break;
        case WM_DESTROY:
            PostQuitMessage(0);
            break;
        default:
            if (message == WM_TASKBARCREATED)
            {
                ShowTrayIcon(NULL, NIM_ADD);
                break;
            }
            return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
Beispiel #22
0
LRESULT CALLBACK
MainWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    switch (Msg)
    {
        case WM_CREATE:
            if (!InitControls(hwnd))
                PostMessage(hwnd, WM_CLOSE, 0, 0);

            if (SettingsInfo.bUpdateAtStart)
                UpdateAppsDB();
            break;

        case WM_COMMAND:
            MainWndOnCommand(hwnd, wParam, lParam);
            break;

        case WM_NOTIFY:
        {
            LPNMHDR data = (LPNMHDR)lParam;

            switch (data->code)
            {
                case TVN_SELCHANGED:
                {
                    if (data->hwndFrom == hTreeView)
                    {
                        switch (((LPNMTREEVIEW)lParam)->itemNew.lParam)
                        {
                            case IDS_INSTALLED:
                                UpdateApplicationsList(ENUM_ALL_COMPONENTS);
                                break;

                            case IDS_APPLICATIONS:
                                UpdateApplicationsList(ENUM_APPLICATIONS);
                                break;

                            case IDS_UPDATES:
                                UpdateApplicationsList(ENUM_UPDATES);
                                break;

                            case IDS_AVAILABLEFORINST:
                                UpdateApplicationsList(ENUM_ALL_AVAILABLE);
                                break;

                            case IDS_CAT_AUDIO:
                                UpdateApplicationsList(ENUM_CAT_AUDIO);
                                break;

                            case IDS_CAT_DEVEL:
                                UpdateApplicationsList(ENUM_CAT_DEVEL);
                                break;

                            case IDS_CAT_DRIVERS:
                                UpdateApplicationsList(ENUM_CAT_DRIVERS);
                                break;

                            case IDS_CAT_EDU:
                                UpdateApplicationsList(ENUM_CAT_EDU);
                                break;

                            case IDS_CAT_ENGINEER:
                                UpdateApplicationsList(ENUM_CAT_ENGINEER);
                                break;

                            case IDS_CAT_FINANCE:
                                UpdateApplicationsList(ENUM_CAT_FINANCE);
                                break;

                            case IDS_CAT_GAMES:
                                UpdateApplicationsList(ENUM_CAT_GAMES);
                                break;

                            case IDS_CAT_GRAPHICS:
                                UpdateApplicationsList(ENUM_CAT_GRAPHICS);
                                break;

                            case IDS_CAT_INTERNET:
                                UpdateApplicationsList(ENUM_CAT_INTERNET);
                                break;

                            case IDS_CAT_LIBS:
                                UpdateApplicationsList(ENUM_CAT_LIBS);
                                break;

                            case IDS_CAT_OFFICE:
                                UpdateApplicationsList(ENUM_CAT_OFFICE);
                                break;

                            case IDS_CAT_OTHER:
                                UpdateApplicationsList(ENUM_CAT_OTHER);
                                break;

                            case IDS_CAT_SCIENCE:
                                UpdateApplicationsList(ENUM_CAT_SCIENCE);
                                break;

                            case IDS_CAT_TOOLS:
                                UpdateApplicationsList(ENUM_CAT_TOOLS);
                                break;

                            case IDS_CAT_VIDEO:
                                UpdateApplicationsList(ENUM_CAT_VIDEO);
                                break;
                        }
                    }
                }
                break;

                case LVN_ITEMCHANGED:
                {
                    LPNMLISTVIEW pnic = (LPNMLISTVIEW) lParam;

                    if (pnic->hdr.hwndFrom == hListView)
                    {
                        /* Check if this is a valid item
                         * (technically, it can be also an unselect) */
                        INT ItemIndex = pnic->iItem;
                        if (ItemIndex == -1 ||
                            ItemIndex >= ListView_GetItemCount(pnic->hdr.hwndFrom))
                        {
                            break;
                        }

                        /* Check if the focus has been moved to another item */
                        if ((pnic->uChanged & LVIF_STATE) &&
                            (pnic->uNewState & LVIS_FOCUSED) &&
                            !(pnic->uOldState & LVIS_FOCUSED))
                        {
                            if (IS_INSTALLED_ENUM(SelectedEnumType))
                                ShowInstalledAppInfo(ItemIndex);
                            if (IS_AVAILABLE_ENUM(SelectedEnumType))
                                ShowAvailableAppInfo(ItemIndex);
                        }
                    }
                }
                break;

                case LVN_COLUMNCLICK:
                {
                    LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;

                    (VOID) ListView_SortItems(hListView, ListViewCompareFunc, pnmv->iSubItem);
                    bAscending = !bAscending;
                }
                break;

                case NM_CLICK:
                    if (data->hwndFrom == hListView)
                    {
                        if (IS_INSTALLED_ENUM(SelectedEnumType))
                            ShowInstalledAppInfo(-1);
                        if (IS_AVAILABLE_ENUM(SelectedEnumType))
                            ShowAvailableAppInfo(-1);
                    }
                    break;

                case NM_RCLICK:
                    if (data->hwndFrom == hListView)
                        ShowPopupMenu(hListView, IDR_APPLICATIONMENU);
                    break;

                case EN_LINK:
                    RichEditOnLink(hwnd, (ENLINK*)lParam);
                    break;

                case TTN_GETDISPINFO:
                    ToolBarOnGetDispInfo((LPTOOLTIPTEXT)lParam);
                    break;
            }
        }
        break;

        case WM_PAINT:
        break;

        case WM_SIZE:
        {
            if ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar) - SPLIT_WIDTH) < GetHSplitterPos())
            {
                INT NewSplitPos = GetClientWindowHeight(hwnd) - 100 - GetWindowHeight(hStatusBar) - SPLIT_WIDTH;
                if (NewSplitPos > GetWindowHeight(hToolBar) + SPLIT_WIDTH)
                    SetHSplitterPos(NewSplitPos);
            }

            MainWndOnSize(hwnd, wParam, lParam);
        }
        break;

        case WM_SIZING:
        {
            int RichEditHeight = GetWindowHeight(hRichEdit);
            LPRECT pRect = (LPRECT)lParam;

            while (RichEditHeight <= 100)
            {
                if (GetHSplitterPos() - 1 < GetWindowHeight(hToolBar) + GetWindowHeight(hListView) + SPLIT_WIDTH)
                    break;
                SetHSplitterPos(GetHSplitterPos() - 1);
                RichEditHeight++;
            }

            if (pRect->right-pRect->left < 565)
                pRect->right = pRect->left + 565;

            if (pRect->bottom-pRect->top < 300)
                pRect->bottom = pRect->top + 300;
            return TRUE;
        }

        case WM_SYSCOLORCHANGE:
        {
            /* Forward WM_SYSCOLORCHANGE to common controls */
            SendMessage(hListView, WM_SYSCOLORCHANGE, 0, 0);
            SendMessage(hTreeView, WM_SYSCOLORCHANGE, 0, 0);
            SendMessage(hToolBar, WM_SYSCOLORCHANGE, 0, 0);
            SendMessageW(hRichEdit, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_BTNFACE));
        }
        break;

        case WM_DESTROY:
        {
            ShowWindow(hwnd, SW_HIDE);
            SaveSettings(hwnd);

            FreeLogs();

            if (IS_AVAILABLE_ENUM(SelectedEnumType))
                FreeAvailableAppList();
            if (IS_INSTALLED_ENUM(SelectedEnumType))
                FreeInstalledAppList();
            if (hImageTreeView) ImageList_Destroy(hImageTreeView);

            PostQuitMessage(0);
            return 0;
        }
        break;
    }

    return DefWindowProc(hwnd, Msg, wParam, lParam);
}
Beispiel #23
0
//================================================
// OnUserCommand
//================================================
// This handler is called every time there is a mouse movement.
LRESULT  CJMBrkr::OnUserCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{

	if (lParam == WM_LBUTTONUP || lParam == WM_RBUTTONUP)
	{
		
		
//		// Show the popup menu.  The return code is the menu item the user
//		// selected, or zero if they didn't make a choice (i.e. by clicking 
//		// outside of the popup menu).
		WORD cmd = ShowPopupMenu(IDR_POPUP_MENU2);
		DWORD dwResult = 100;
		CString szUrl;
		m_Authenticate.ReadHost(szUrl);
		switch (cmd)
		{
			case ID_TRAY_MYACCOUNT:
			{
				//HandleMyAccount();
				break;
			}

			case ID_TRAY_UPGRADENOW:
			{
				ShowUpgradePage(SOURCE_TRAYICON);
				break;
			}

			case ID_TRAY_HOME:
			{
				//HandleHome();
				break;
			}
		
			case ID_TRAY_NEWEMAIL:
			{
				//HandleNewMail();
				break;
			}
			case ID_TRAY_FEEDBACK:
			{
				ShowFeedbackPage();
				break;
			}

			case ID_TRAY_HELP:
			{
				if (GetKeyState(VK_CONTROL) < 0)
					ProcessExecuteCommand(CMD_REGISTERADDIN);
				else if (GetKeyState(VK_SHIFT) < 0)
					ProcessExecuteCommand(CMD_UNREGISTERADDIN);
				else
					m_OptPropsheet.HandleHelp();
				
				break;
			}
			case ID_TRAY_SETTINGS:
			{
				if (GetKeyState(VK_CONTROL) < 0)
					Shutdown();
				else
					ManageOptions();
			
				break;
			}
			case ID_TRAY_LAUNCH:
			{
				ProcessExecuteCommand(CMD_CMLAUNCH);
				break;
			}
			case ID_TRAY_ABOUT:
			{
				/*CAboutDlg dlgAbout(VER_PRODUCT_VERSION_STR);
				dlgAbout.DoModal();*/
				break;
			}
//
//#ifdef NOTUSED
//			case ID_HELP_TOPICS:
//			{
//				break;
//			}
//
//			case ID_HELP_FAQ:
//			{
//				break;
//			}
//#endif NOTUSED
//
//			case ID_HELP_FEEDBACK:
//			{
//				szUrl += DEFAULT_FEEDBACK;
//				dwResult = (DWORD)::ShellExecute(NULL, "open", szUrl, NULL, NULL, SW_SHOWNORMAL);
//				break;
//			}
			
			default:
				break;
		}

		if (dwResult <= 32)
			::MessageBox(NULL, "System tray failure", "System Tray", MB_OK);
	}

	return S_OK;
}