Example #1
0
void
OptionTabWindow::get()
{
    HWND w;
    struct HpcMenuInterface::HpcMenuPreferences &pref = HPC_PREFERENCE;
    if (IS_CHECKED(AUTO)) {
        TCHAR tmp[32];
        Edit_GetText(_spin_edit, tmp, 32);
        pref.auto_boot = _wtoi(tmp);
    } else
        pref.auto_boot = 0;
    pref.reverse_video	= IS_CHECKED(VIDEO);
    pref.pause_before_boot	= IS_CHECKED(PAUSE);
    pref.load_debug_info	= IS_CHECKED(DEBUG);
    pref.safety_message	= IS_CHECKED(SAFETY);

    w = GetDlgItem(_window, IDC_OPT_EXTKOPT);
    Edit_GetText(w, pref.boot_extra, MAX_BOOT_STR);
}
Example #2
0
void
OptionTabWindow::command(int id, int msg)
{
    switch (id) {
    case IDC_OPT_AUTO:
        if (IS_CHECKED(AUTO)) {
            EnableWindow(_spin_edit, TRUE);
            EnableWindow(_spin, TRUE);
        } else {
            EnableWindow(_spin_edit, FALSE);
            EnableWindow(_spin, FALSE);
        }
        break;
    }
}
Example #3
0
///////////////////////////////////////////////////////////////////////////////
// Paint the toolbar
void CToolBarXP::OnPaint ()
{
    if ( m_bDelayedButtonLayout )
    {
        Layout();
    }
    CPaintDC cpDC (this);
    CBufferDC cDC (cpDC);
    CRect rcClip;
    cDC.GetClipBox (rcClip);
    cDC.SetBkMode (TRANSPARENT);
    cDC.SelectObject (CFont::FromHandle ((HFONT)GetStockObject (DEFAULT_GUI_FONT)));

    cDC.FillSolidRect (rcClip, HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), 20, 0));

    CPoint ptCursor;
    ::GetCursorPos (&ptCursor);
    ScreenToClient (&ptCursor);

    CClientRect rcClient (this);
    HIMAGELIST m_hImageList = (HIMAGELIST)DefWindowProc (TB_GETIMAGELIST, 0, 0);
    TBBUTTON tbbutton;
    int nCount = DefWindowProc (TB_BUTTONCOUNT, 0, 0);
    int nHotItem = GetToolBarCtrl().GetHotItem();

    for ( int i = 0; i < nCount; i++ )
    {
        VERIFY(DefWindowProc (TB_GETBUTTON, i, (LPARAM)&tbbutton));

        if ( !IS_VISIBLE(tbbutton) )
        {
            continue;
        }
        CRect rcButton;
        VERIFY(DefWindowProc (TB_GETITEMRECT, i, (LPARAM)&rcButton));

        if ( !CRect().IntersectRect (rcClip, rcButton) )
        {
            continue;
        }
        bool bOver = nHotItem == i && IS_ENABLED(tbbutton);
        bool bPressed = false;

        if ( IS_INDETERMINATE(tbbutton) )
        {
            CPenDC pen (cDC, ::GetSysColor (COLOR_3DSHADOW));

            cDC.MoveTo (rcButton.left, rcButton.bottom);
            cDC.LineTo (rcButton.left, rcButton.top);
            cDC.LineTo (rcButton.right-1, rcButton.top);
            cDC.LineTo (rcButton.right-1, rcButton.bottom-1);
            cDC.LineTo (rcButton.left, rcButton.bottom-1);
            bOver = true;
        }
        else if ( bOver || IS_CHECKED(tbbutton) )
        {
            bPressed = KEYDOWN(VK_LBUTTON) && rcButton.PtInRect (ptCursor);

            if ( IS_DROPDOWN(tbbutton) && bPressed )
            {
                bPressed = ptCursor.x < rcButton.right-13;

                if ( bPressed )
                {
                    rcButton.right -= 13;
                }
            }
            COLORREF crHighLight = ::GetSysColor (COLOR_HIGHLIGHT);
            CPenDC pen (cDC, crHighLight);
            CBrushDC brush (cDC, bPressed||(bOver&&IS_CHECKED(tbbutton)) ? HLS_TRANSFORM (crHighLight, +50, -50) : (bOver ? HLS_TRANSFORM (crHighLight, +70, -57) : HLS_TRANSFORM (crHighLight, +80, -66)));

            cDC.Rectangle (&rcButton);

            if ( IS_DROPDOWN(tbbutton) )
            {
                if ( bPressed )
                {
                    int nLeft = rcButton.left;

                    rcButton.left = rcButton.right-1;
                    rcButton.right += 13;

                    brush.Color (HLS_TRANSFORM (crHighLight, +70, -66));
                    cDC.Rectangle (&rcButton);

                    rcButton.left = nLeft;
                }
                else
                {
                    cDC.MoveTo (rcButton.right-14, rcButton.top);
                    cDC.LineTo (rcButton.right-14, rcButton.bottom);
                }
            }
        }
        if ( IS_SEPARATOR(tbbutton) )
        {
            CPenDC pen (cDC, HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), -15, 0));

            if ( IS_WRAP(tbbutton) )
            {
                cDC.MoveTo (rcClient.left+2, rcButton.bottom-4);
                cDC.LineTo (rcClient.right-2, rcButton.bottom-4);
            }
            else
            {
                cDC.MoveTo ((rcButton.right+rcButton.left)/2-1, rcButton.top+2);
                cDC.LineTo ((rcButton.right+rcButton.left)/2-1, rcButton.bottom-2);
            }
        }
        else if ( !IS_CONTROL(tbbutton) )
        {
            if ( IS_DROPDOWN(tbbutton) )
            {
                CPenDC pen (cDC, ( bOver && !IS_INDETERMINATE(tbbutton) ) ? RGB(0,0,0) : ::GetSysColor (IS_ENABLED(tbbutton) ? COLOR_BTNTEXT : COLOR_GRAYTEXT));

                cDC.MoveTo (rcButton.right-9, (rcButton.top+rcButton.bottom)/2-1);
                cDC.LineTo (rcButton.right-4, (rcButton.top+rcButton.bottom)/2-1);
                cDC.MoveTo (rcButton.right-8, (rcButton.top+rcButton.bottom)/2);
                cDC.LineTo (rcButton.right-5, (rcButton.top+rcButton.bottom)/2);
                cDC.SetPixel (rcButton.right-7, (rcButton.top+rcButton.bottom)/2+1, pen.Color());

                rcButton.right -= 14;
            }
            if ( tbbutton.iBitmap >= 0 )
            {
                if ( !IS_ENABLED(tbbutton) || (bOver && !bPressed) )
                {
                    HICON hIcon = ImageList_ExtractIcon (NULL, m_hImageList, tbbutton.iBitmap);
                    cDC.DrawState (CPoint (rcButton.left + ( bOver ? 4 : 3 ), rcButton.top + ( bOver ? 4 : 3 )), m_sizeImage, hIcon, DSS_MONO, CBrush (bOver ? (IS_INDETERMINATE(tbbutton) ? HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), -20, 0) : HLS_TRANSFORM (::GetSysColor (COLOR_HIGHLIGHT), +50, -66)) : HLS_TRANSFORM (::GetSysColor (COLOR_3DFACE), -27, 0)));
                    DestroyIcon (hIcon);
                }
                if ( IS_ENABLED(tbbutton) )
                {
                    ::ImageList_Draw (m_hImageList, tbbutton.iBitmap, cDC.m_hDC,
                                      rcButton.left + ( (bOver && !bPressed) ? 2 : 3 ), rcButton.top + ( (bOver && !bPressed) ? 2 : 3 ), ILD_TRANSPARENT);
                }
            }
        }
    }
}
Example #4
0
LRESULT
FilterOnItemChanged(
	IN HWND hWnd,
	IN HWND hWndTree,
	IN HTREEITEM hItem,
	IN ULONG NewState,
	IN ULONG OldState,
	IN LPARAM Param
	)
{
	HTREEITEM Parent;
	ULONG Checked, Unchecked;
	PDIALOG_OBJECT Object;
	PFILTER_CONTEXT Context;
	WCHAR Buffer[MAX_PATH];
	WCHAR Format[MAX_PATH];
	PFILTER_NODE Node;
	PBTR_FILTER Filter;
	TVITEM Item = {0};

	Object = (PDIALOG_OBJECT)SdkGetObject(hWnd);
	Context = SdkGetContext(Object, FILTER_CONTEXT);

	Checked = INDEXTOSTATEIMAGEMASK(CHECKED);
	Unchecked = INDEXTOSTATEIMAGEMASK(UNCHECKED);

	Parent = TreeView_GetParent(hWndTree, hItem);

	if (IS_CHECKED(NewState) && IS_UNCHECKED(OldState)) {

		if (Parent != NULL) {

			Item.mask = TVIF_PARAM;
			Item.hItem = Parent;
			TreeView_GetItem(hWndTree, &Item);

			Node = (PFILTER_NODE)Item.lParam;
			Filter = Node->Filter;

			Node->NumberOfSelected += 1;
			Context->NumberOfSelected += 1;

			if (Node->NumberOfSelected == Filter->ProbesCount) {
				TreeView_SetCheckState(hWndTree, Parent, TRUE);
			}

			//
			// Get tree item text and insert into list control
			//

			Item.mask = TVIF_TEXT;
			Item.hItem = hItem;
			Item.pszText = Buffer;
			Item.cchTextMax = MAX_PATH;
			TreeView_GetItem(hWndTree, &Item);

			FilterInsertListItem(hWnd, hWndTree, Node, hItem, Buffer, TRUE);

			LoadString(SdkInstance, IDS_FILTER_SELECT, Format, MAX_PATH);
			StringCchPrintf(Buffer, MAX_PATH, Format, Context->NumberOfSelected);
			SetWindowText(GetDlgItem(hWnd, IDC_STATIC), Buffer);

		} 
		
		else {
			
			Node = (PFILTER_NODE)Param;
			Filter = Node->Filter;

			if (Node->NumberOfSelected != Filter->ProbesCount) {
				FilterCheckChildren(hWnd, Context, Node, hWndTree, hItem, TRUE);
			}
		}
	}

	if (IS_UNCHECKED(NewState) && IS_CHECKED(OldState)) {

		if (Parent != NULL) {

			Item.mask = TVIF_PARAM;
			Item.hItem = Parent;
			TreeView_GetItem(hWndTree, &Item);

			Node = (PFILTER_NODE)Item.lParam;
			Node->NumberOfSelected -= 1;
			Context->NumberOfSelected -= 1;

			//
			// N.B. Parent node is checked only if all children are checked
			// so whenever a child is unchecked, we need uncheck its parent node.
			//

			TreeView_SetCheckState(hWndTree, Parent, FALSE);

			//
			// Delete item in list control
			//

			FilterInsertListItem(hWnd, hWndTree, Node, hItem, NULL, FALSE);

			LoadString(SdkInstance, IDS_FILTER_SELECT, Format, MAX_PATH);
			StringCchPrintf(Buffer, MAX_PATH, Format, Context->NumberOfSelected);
			SetWindowText(GetDlgItem(hWnd, IDC_STATIC), Buffer);

		} 
		
		else {

			Node = (PFILTER_NODE)Param;
			Filter = Node->Filter;

			//
			// N.B. This can happen only if initially all children are checked,
			// user then uncheck the parent node, if the user unchecked a child
			// node, the NumberOfSelected would be (Filter->ProbesCount - 1)
			//

			if (Node->NumberOfSelected == Filter->ProbesCount) {
				FilterCheckChildren(hWnd, Context, Node, hWndTree, hItem, FALSE);
			}
		}
	}

	TreeView_SelectItem(hWndTree, hItem);
	return 0;
}
Example #5
0
LRESULT CLoginDlg::OnClickedUseIeCookies(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	::EnableWindow(GetDlgItem(IDC_LOGINEDIT), IS_CHECKED(IDC_DOAUTH));
	::EnableWindow(GetDlgItem(IDC_PASSWORDEDIT), IS_CHECKED(IDC_DOAUTH)&&m_UploadEngine->NeedPassword);
	return 0;
}
Example #6
0
static
INT_PTR CALLBACK
SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    switch (Msg)
    {
    case WM_INITDIALOG:
    {
        NewSettingsInfo = SettingsInfo;
        InitSettingsControls(hDlg, &SettingsInfo);
    }
    break;

    case WM_COMMAND:
    {
        switch (LOWORD(wParam))
        {
        case IDC_CHOOSE:
            ChooseFolder(hDlg);
            break;

        case IDC_SAVE_WINDOW_POS:
            IS_CHECKED(NewSettingsInfo.bSaveWndPos, IDC_SAVE_WINDOW_POS);
            break;

        case IDC_UPDATE_AVLIST:
            IS_CHECKED(NewSettingsInfo.bUpdateAtStart, IDC_UPDATE_AVLIST);
            break;

        case IDC_LOG_ENABLED:
            IS_CHECKED(NewSettingsInfo.bLogEnabled, IDC_LOG_ENABLED);
            break;

        case IDC_DEL_AFTER_INSTALL:
            IS_CHECKED(NewSettingsInfo.bDelInstaller, IDC_DEL_AFTER_INSTALL);
            break;

        case IDC_DEFAULT_SETTINGS:
            FillDefaultSettings(&NewSettingsInfo);
            InitSettingsControls(hDlg, &NewSettingsInfo);
            break;

        case IDOK:
        {
            WCHAR szDir[MAX_PATH];
            DWORD dwAttr;

            GetWindowTextW(GetDlgItem(hDlg, IDC_DOWNLOAD_DIR_EDIT),
                           szDir, MAX_PATH);

            dwAttr = GetFileAttributesW(szDir);
            if (dwAttr != INVALID_FILE_ATTRIBUTES &&
                    (dwAttr & FILE_ATTRIBUTE_DIRECTORY))
            {
                StringCbCopyW(NewSettingsInfo.szDownloadDir,
                              sizeof(NewSettingsInfo.szDownloadDir),
                              szDir);
            }
            else
            {
                WCHAR szMsgText[MAX_STR_LEN];

                LoadStringW(hInst,
                            IDS_CHOOSE_FOLDER_ERROR,
                            szMsgText, sizeof(szMsgText) / sizeof(WCHAR));

                if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
                {
                    if (CreateDirectoryW(szDir, NULL))
                    {
                        EndDialog(hDlg, LOWORD(wParam));
                    }
                }

                SetFocus(GetDlgItem(hDlg, IDC_DOWNLOAD_DIR_EDIT));
                break;
            }

            SettingsInfo = NewSettingsInfo;
            SaveSettings(GetParent(hDlg));
            EndDialog(hDlg, LOWORD(wParam));
        }
        break;

        case IDCANCEL:
            EndDialog(hDlg, LOWORD(wParam));
            break;
        }
    }
    break;
    }

    return FALSE;
}
Example #7
0
int difference_direntrylist()
{
	int ndiffs;                                             /* Number of differences found */
	struct direntry* entry_prev;    /* Pointer to iterate through previous direntrylist */
	struct direntry* entry_cur;             /* Pointer to iterate through current direntry list */

	ndiffs = 0;

	// Populate the curdir list with entries in directory right now
	exploredir(curdir, (const char*)full_path);  /* Global variable: full_path */

	// No differences if there is no entries in the directory
	if (curdir->count == 0 && prevdir->count == 0) {
		return 0;
	}

	entry_prev = prevdir->head;
	while (entry_prev != NULL) {
		if ((entry_cur = find_direntry(curdir, entry_prev)) != NULL
		    && !IS_CHECKED(entry_prev->mask)) {
			// Permissions
			if (entry_prev->attrs.st_mode != entry_cur->attrs.st_mode) {
				SET_MODIFIED(entry_prev->mask);
				SET_PERM(entry_prev->mask);
				ndiffs++;
			}
			// UID
			if (entry_prev->attrs.st_uid != entry_cur->attrs.st_uid) {
				SET_MODIFIED(entry_prev->mask);
				SET_UID(entry_prev->mask);
				ndiffs++;
			}
			// GID
			if (entry_prev->attrs.st_gid != entry_cur->attrs.st_gid) {
				SET_MODIFIED(entry_prev->mask);
				SET_GID(entry_prev->mask);
				ndiffs++;
			}
			// Size
			if (entry_prev->attrs.st_size != entry_cur->attrs.st_size) {
				SET_MODIFIED(entry_prev->mask);
				SET_SIZE(entry_prev->mask);
				ndiffs++;
			}
			// Access time
			if (entry_prev->attrs.st_atime != entry_cur->attrs.st_atime) {
				SET_MODIFIED(entry_prev->mask);
				SET_LAT(entry_prev->mask);
				ndiffs++;
			}
			// Modified time
			if (entry_prev->attrs.st_mtime != entry_cur->attrs.st_mtime) {
				SET_MODIFIED(entry_prev->mask);
				SET_LMT(entry_prev->mask);
				ndiffs++;
			}
			// File status time
			if (entry_prev->attrs.st_ctime != entry_cur->attrs.st_ctime) {
				SET_MODIFIED(entry_prev->mask);
				SET_LFST(entry_prev->mask);
				ndiffs++;
			}

			// Show that the entries have been checked for differences
			// and not to check them again
			SET_CHECKED(entry_prev->mask);
			SET_CHECKED(entry_cur->mask);
		} else {
			// If a previous entry cannot be found in the current directory,
			// it was removed
			SET_REMOVED(entry_prev->mask);
			ndiffs++;
		}

		entry_prev = entry_prev->next;
	}

	// Now check for any entries that have been added to the monitored
	// directory
	entry_cur = curdir->head;
	while (entry_cur != NULL) {
		if (!IS_CHECKED(entry_cur->mask)) {
			SET_ADDED(entry_cur->mask);
			ndiffs++;
		}

		entry_cur = entry_cur->next;
	}

	return ndiffs;
}