StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 3-in-1 control -- Resize window or Tile window
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Luna

6 Posts

Posted - 12/21/2014 :  15:00:26  Show Profile  Reply with Quote
-- Define Mouse Gesture direction (\)

-- Combo - 3in1 Functions

-- (Single Window Mode)
-- Gesture Start and End in the single window
-- (current Window) --> (center window) <--> resize to 1/3 @ corner

-- (Tile Window Mode, side by side)
-- Gesture cross two window and make it tile side by side
-- If both windows are same title, then Switch to single window mode

-- Get Window Position
local hFirstWindow = acGetOwnerWindowByPoint(gsx, gsy)
local hSecondWindow = acGetOwnerWindowByPoint(gex, gey)
local hFirstWindowLeft = acGetWindowLeft(hFirstWindow)
local hFirstWindowRight = acGetWindowRight(hFirstWindow)
local hFirstWindowTitle = acGetWindowTitle(hFirstWindow, 0, 0)
local hSecondWindowTitle = acGetWindowTitle(hSecondWindow, 0, 0)

--Get Current Screen Position
local hScreen = acGetMonitorFromPoint(gsx, gsy)
local iScreenTop = acGetMonitorTop(hScreen, 1)
local iScreenBottom = acGetMonitorBottom(hScreen, 1)
local iScreenRight = acGetMonitorRight(hScreen, 1)
local iScreenLeft = acGetMonitorLeft(hScreen, 1)
local iScreenHeight = iScreenBottom - iScreenTop
local iScreenWidth = iScreenRight - iScreenLeft

acActivateWindow(hFirstWindow, 0, 0, 0)

if hFirstWindowTitle == hSecondWindowTitle and
gsx>=hFirstWindowLeft and gex<=hFirstWindowRight or
hSecondWindowTitle == ""
then

-- Toggle Current Windows Position Center or Semi-Minimize
local nWinPos = iScreenLeft+iScreenWidth/8

acRestoreWindow(hFirstWindow, 0, 0)
if hFirstWindowLeft <= iScreenWidth+nWinPos and
hFirstWindowLeft ~= nWinPos
then
-- Center Window Width75% Height90%
acMoveWindow(hFirstWindow, 0, 0, nWinPos, iScreenTop+iScreenHeight/20)
acSetWindowSize(hFirstWindow, 0, 0, iScreenWidth-iScreenWidth/4, iScreenHeight-iScreenHeight/10)

else
-- Semi-Window 2/3 size
acMoveWindow(hFirstWindow, 0, 0, iScreenLeft+iScreenWidth-iScreenWidth/3, iScreenTop+iScreenHeight/3)
acSetWindowSize(hFirstWindow, 0, 0, iScreenWidth/3, iScreenHeight-iScreenHeight/3)
end

else
-- Tile Two Windows side by side
acRestoreWindow(hFirstWindow, 0, 0)
acRestoreWindow(hSecondWindow, 0, 0)

--Move to position
acActivateWindow(hFirstWindow, 0, 0, 0)
acMoveWindow(hFirstWindow, 0, 0, iScreenLeft, iScreenTop)
acMoveWindow(hSecondWindow, 0, 0, iScreenLeft+iScreenWidth/2, iScreenTop)

--Size them accordingly
local iReserveHeight=20 -- 20pix reserve, personal favor

acSetWindowSize(hFirstWindow, 0, 0, iScreenWidth/2, iScreenHeight-iReserveHeight)
acSetWindowSize(hSecondWindow, 0, 0, iScreenWidth/2, iScreenHeight-iReserveHeight)
end

Edited by - Luna on 12/21/2014 15:34:23

Luna

6 Posts

Posted - 12/21/2014 :  17:36:12  Show Profile  Reply with Quote
sharing the idea
Go to Top of Page

babakm

58 Posts

Posted - 12/30/2014 :  12:58:16  Show Profile  Reply with Quote
Please simply explain what we should do?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000