Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
RamonUnch authored Dec 8, 2020
1 parent e5aeebb commit 8c2fd1a
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 33 deletions.
4 changes: 3 additions & 1 deletion AltDrag.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Note that this version has some more feature..
== CHANGELOG ==
== AltDrag 1.31 ==

+ Added option to replace the resize center mode with Move mode.
GUI was adjusted accordingly

* Improved the non full windows dragging mode, it will no longer move the
window when it snaps but only the transparent square and the window will
be moved when click is released as expected.
Expand All @@ -36,7 +39,6 @@ Note that this version has some more feature..

* Fixed some annoying behavior in the in case of unresponsive windows.


== AltDrag 1.30 ==

+ Re-introduced the Aero snap at top to maximize a window. this behavior can
Expand Down
Binary file modified Lang/_en_US baseline.txt
Binary file not shown.
Binary file modified Lang/fr_FR.ini
Binary file not shown.
Binary file modified Lang/it_IT.ini
Binary file not shown.
18 changes: 15 additions & 3 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ INT_PTR CALLBACK GeneralPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
Button_SetCheck(GetDlgItem(hwnd, IDC_RESIZEALL), ret? BST_CHECKED : BST_UNCHECKED);

ret=GetPrivateProfileInt(L"General", L"ResizeCenter", 1, inipath);
Button_SetCheck(GetDlgItem(hwnd, IDC_RESIZECENTER), ret? BST_CHECKED : BST_UNCHECKED);
ret = ret==1? IDC_RZCENTER_NORM: ret==2? IDC_RZCENTER_MOVE: IDC_RZCENTER_BR;
CheckRadioButton(hwnd, IDC_RZCENTER_NORM, IDC_RZCENTER_MOVE, ret);

HWND control = GetDlgItem(hwnd, IDC_LANGUAGE);
ComboBox_ResetContent(control);
Expand Down Expand Up @@ -305,8 +306,16 @@ INT_PTR CALLBACK GeneralPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
WritePrivateProfileString(L"Performance",L"FullWin", _itow(val, txt, 10), inipath);
} else if (id == IDC_RESIZEALL) {
WritePrivateProfileString(L"Advanced", L"ResizeAll", _itow(val, txt, 10), inipath);
} else if (id == IDC_RESIZECENTER) {
WritePrivateProfileString(L"General", L"ResizeCenter", _itow(val, txt, 10), inipath);

} else if (id == IDC_RZCENTER_NORM) {
CheckRadioButton(hwnd, IDC_RZCENTER_NORM, IDC_RZCENTER_MOVE, IDC_RZCENTER_NORM);
WritePrivateProfileString(L"General", L"ResizeCenter", L"1", inipath);
} else if (id == IDC_RZCENTER_BR) {
CheckRadioButton(hwnd, IDC_RZCENTER_NORM, IDC_RZCENTER_MOVE, IDC_RZCENTER_BR);
WritePrivateProfileString(L"General", L"ResizeCenter", L"0", inipath);
} else if (id == IDC_RZCENTER_MOVE) {
CheckRadioButton(hwnd, IDC_RZCENTER_NORM, IDC_RZCENTER_MOVE, IDC_RZCENTER_MOVE);
WritePrivateProfileString(L"General", L"ResizeCenter", L"2", inipath);

} else if (id == IDC_LANGUAGE && event == CBN_SELCHANGE) {
int i = ComboBox_GetCurSel(control);
Expand Down Expand Up @@ -382,6 +391,9 @@ INT_PTR CALLBACK GeneralPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
SetDlgItemText(hwnd, IDC_FULLWIN, l10n->general_fullwin);
SetDlgItemText(hwnd, IDC_RESIZEALL, l10n->general_resizeall);
SetDlgItemText(hwnd, IDC_RESIZECENTER, l10n->general_resizecenter);
SetDlgItemText(hwnd, IDC_RZCENTER_NORM, l10n->general_resizecenter_norm);
SetDlgItemText(hwnd, IDC_RZCENTER_BR, l10n->general_resizecenter_br);
SetDlgItemText(hwnd, IDC_RZCENTER_MOVE, l10n->general_resizecenter_move);

SetDlgItemText(hwnd, IDC_AUTOSTART_BOX, l10n->general_autostart_box);
SetDlgItemText(hwnd, IDC_AUTOSTART, l10n->general_autostart);
Expand Down
34 changes: 27 additions & 7 deletions hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,8 +972,10 @@ static void MouseMove(POINT pt)
if (mm_start && IsZoomed(state.hwnd)) {
WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT) };
GetWindowPlacement(state.hwnd, &wndpl);

// Set size to monitor to prevent flickering
wnd = wndpl.rcNormalPosition = state.mdiclient? mdimon: GetMonitorRect(pt);

if (state.mdiclient) {
// Make it a little smaller since MDIClients by
// default have scrollbars that would otherwise appear
Expand All @@ -1000,6 +1002,7 @@ static void MouseMove(POINT pt)
, wnd.top + mdiclientpt.y - borders.top
, wnd.right + mdiclientpt.x + borders.right
, wnd.bottom+ mdiclientpt.y + borders.bottom };

}
// Clear restore flag
state.wndentry->restore = 0;
Expand Down Expand Up @@ -1552,6 +1555,10 @@ static int ActionMaxRestMin(POINT pt, int delta)
static HCURSOR CursorToDraw()
{
HCURSOR cursor;

if(state.action == AC_MOVE)
return cursors[HAND];

if ((state.resize.y == RZ_TOP && state.resize.x == RZ_LEFT)
|| (state.resize.y == RZ_BOTTOM && state.resize.x == RZ_RIGHT)) {
cursor = cursors[SIZENWSE];
Expand All @@ -1572,7 +1579,13 @@ static HCURSOR CursorToDraw()
/////////////////////////////////////////////////////////////////////////////
static int ActionMove(HMONITOR monitor )
{
if (!monitor) {
POINT pt;
GetCursorPos(&pt);
monitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
}
// Toggle Maximize window if this is a double-click

if (GetTickCount()-state.clicktime <= conf.dbclktime && IsResizable(state.hwnd)) {
state.action = AC_NONE; // Stop move action
state.clicktime = 0; // Reset double-click time
Expand Down Expand Up @@ -1679,11 +1692,15 @@ static int ActionResize(POINT pt, POINT mdiclientpt, RECT *wnd, RECT mon)
// Prevent mousedown from propagating
return 1;
}
if (!conf.ResizeCenter && state.resize.y == RZ_CENTER && state.resize.x == RZ_CENTER) {
state.resize.x = RZ_RIGHT;
state.resize.y = RZ_BOTTOM;
state.offset.y = wnd->bottom-pt.y;
state.offset.x = wnd->right-pt.x;
if (state.resize.y == RZ_CENTER && state.resize.x == RZ_CENTER) {
if (conf.ResizeCenter == 0) {
state.resize.x = RZ_RIGHT;
state.resize.y = RZ_BOTTOM;
state.offset.y = wnd->bottom-pt.y;
state.offset.x = wnd->right-pt.x;
} else if (conf.ResizeCenter == 2) {
state.action = AC_MOVE;
}
}

return -1;
Expand Down Expand Up @@ -1826,6 +1843,7 @@ static int init_movement_and_actions(POINT pt, enum action action, int nCode, WP
GetMinMaxInfo_glob(state.hwnd); // for CLAMPH/W functions

int ret = ActionResize(pt, mdiclientpt, &wnd, mon);
action = state.action;
if(ret==1) return 1;
else if (ret==0) CallNextHookEx(NULL, nCode, wParam, lParam);

Expand Down Expand Up @@ -2009,14 +2027,16 @@ __declspec(dllexport) LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wPara
return 1;

} else if (state.alt && buttonstate == STATE_DOWN) {
if(!init_movement_and_actions(pt, action, nCode, wParam, lParam)) {
int ret = init_movement_and_actions(pt, action, nCode, wParam, lParam);
action = state.action;
if(!ret) {
return CallNextHookEx(NULL, nCode, wParam, lParam);
} else {
return 1;
}

// FINISHING THE MOVE
} else if (buttonstate == STATE_UP && state.action == action) {
} else if (buttonstate == STATE_UP && state.action) {
if (!mm_start && LastWin.hwnd) {
if(!conf.FullWin) // to erase the last rectangle...
Rectangle(hdcc, oldRect.left, oldRect.top, oldRect.right, oldRect.bottom);
Expand Down
11 changes: 10 additions & 1 deletion languages.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ struct strings {
wchar_t *general_fullwin;
wchar_t *general_resizeall;
wchar_t *general_resizecenter;

wchar_t *general_resizecenter_norm;
wchar_t *general_resizecenter_br;
wchar_t *general_resizecenter_move;

// general autostart
wchar_t *general_autostart_box;
wchar_t *general_autostart;
Expand Down Expand Up @@ -178,6 +181,9 @@ struct {
{ &l10n_ini.general_fullwin, L"GeneralFullWin" },
{ &l10n_ini.general_resizeall, L"GeneralResizeAll" },
{ &l10n_ini.general_resizecenter, L"GeneralResizeCenter" },
{ &l10n_ini.general_resizecenter_norm, L"GeneralResizeCenterNorm" },
{ &l10n_ini.general_resizecenter_br, L"GeneralResizeCenterBr" },
{ &l10n_ini.general_resizecenter_move, L"GeneralResizeCenterMove" },

{ &l10n_ini.general_autostart_box, L"GeneralAutostartBox" },
{ &l10n_ini.general_autostart, L"GeneralAutostart" },
Expand Down Expand Up @@ -288,6 +294,9 @@ struct strings en_US = {
/* FullWin */ L"&Drag full windows",
/* ResizeAll */ L"&Resize all windows",
/* ResizeCenter */ L"&Center resize mode",
/* ResizeCenterNorm */ L"All d&irections",
/* ResizeCenterBr */ L"B&ottom right",
/* ResizeCenterMove */ L"Mo&ve",

/* autostart_box */ L"Autostart",
/* autostart */ L"S&tart "APP_NAME" when logging on",
Expand Down
4 changes: 4 additions & 0 deletions resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,7 @@
#define IDC_PAUSEBL 2014
#define IDC_MDISBL_HEADER 2015
#define IDC_MDIS 2016

#define IDC_RZCENTER_NORM 2017
#define IDC_RZCENTER_BR 2018
#define IDC_RZCENTER_MOVE 2019
45 changes: 24 additions & 21 deletions window.rc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BEGIN

ICON app_icon, IDC_STATIC, 15,15,0,0
LTEXT "Version",IDC_VERSION, 48, 15, 160,8
LTEXT "https://stefansundin.github.io/altdrag/", 0, 48,25,160,10
EDITTEXT IDC_URL, 48,25,160,10, ES_READONLY | NOT WS_BORDER
LTEXT "Created by Stefan Sundin",IDC_AUTHOR, 10, 40, 200, 8
LTEXT "https://stefansundin.com/", 0, 10,50,200,10

Expand Down Expand Up @@ -55,26 +55,29 @@ EXSTYLE WS_EX_WINDOWEDGE
CAPTION "General"
FONT 8, "Ms Shell Dlg"
BEGIN
GROUPBOX "General", IDC_GENERAL_BOX,3,1,212,120
CONTROL "AutoFocus", IDC_AUTOFOCUS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP | BS_MULTILINE,10,13,195,18
CONTROL "Aero", IDC_AERO, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10, 31,195,8
CONTROL "InactiveScroll", IDC_INACTIVESCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,43,195,8
CONTROL "MDI", IDC_MDI, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10, 55,195,8

CONTROL "FullWin", IDC_FULLWIN, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,110, 76,102,8
CONTROL "ResizeAll", IDC_RESIZEALL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,110, 90,102,8
CONTROL "resizeCenter",IDC_RESIZECENTER, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,104,102,8

LTEXT "AutoSnap:", IDC_AUTOSNAP_HEADER,10,65,95,8
COMBOBOX IDC_AUTOSNAP, 10,75 ,95,120, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_TABSTOP
LTEXT "Language:", IDC_LANGUAGE_HEADER,10,90,95,8
COMBOBOX IDC_LANGUAGE, 10,100,95,120, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_TABSTOP | WS_VSCROLL

GROUPBOX "Autostart",IDC_AUTOSTART_BOX ,3,125,212,53
CONTROL "Autostart",IDC_AUTOSTART, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,137,195,8
CONTROL "Hide tray",IDC_AUTOSTART_HIDE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,150,195,8
CONTROL "Elevate", IDC_AUTOSTART_ELEVATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,163,140,8
DEFPUSHBUTTON "Elevate", IDC_ELEVATE, 153,160,58,14
GROUPBOX "General", IDC_GENERAL_BOX,3,1,212,132
CONTROL "AutoFocus", IDC_AUTOFOCUS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP | BS_MULTILINE,10,13,195,18
CONTROL "Aero", IDC_AERO, "Button",BS_AUTOCHECKBOX | WS_TABSTOP, 10, 30, 195,8
CONTROL "InactiveScroll",IDC_INACTIVESCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 10, 40, 195,8
CONTROL "MDI", IDC_MDI, "Button",BS_AUTOCHECKBOX | WS_TABSTOP, 10, 50, 195,8
CONTROL "FullWin", IDC_FULLWIN, "Button",BS_AUTOCHECKBOX | WS_TABSTOP, 10, 60, 195,8
CONTROL "ResizeAll", IDC_RESIZEALL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP, 10, 70, 195,8

GROUPBOX "ResizeCenter", IDC_RESIZECENTER, 110,88, 102,42
RADIOBUTTON "All d&irections",IDC_RZCENTER_NORM, 115,98, 95,8, WS_GROUP|WS_TABSTOP
RADIOBUTTON "B&ottom right", IDC_RZCENTER_BR, 115,108, 95,8, WS_GROUP|WS_TABSTOP
RADIOBUTTON "Mo&ve", IDC_RZCENTER_MOVE, 115,118, 95,8, WS_GROUP|WS_TABSTOP

LTEXT "AutoSnap:", IDC_AUTOSNAP_HEADER,10,82,95,8
COMBOBOX IDC_AUTOSNAP, 10,91 ,95,120, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_TABSTOP
LTEXT "Language:", IDC_LANGUAGE_HEADER,10,105,95,8
COMBOBOX IDC_LANGUAGE, 10,115,95,120, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_TABSTOP | WS_VSCROLL

GROUPBOX "Autostart",IDC_AUTOSTART_BOX ,3,135,212,43
CONTROL "Autostart",IDC_AUTOSTART, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,145,195,8
CONTROL "Hide tray",IDC_AUTOSTART_HIDE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,155,140,8
CONTROL "Elevate", IDC_AUTOSTART_ELEVATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,165,140,8
DEFPUSHBUTTON "Elevate", IDC_ELEVATE, 155,160,55,14

LTEXT "Note: Instant!",IDC_AUTOSAVE,3,180,216,8

Expand Down

0 comments on commit 8c2fd1a

Please sign in to comment.