Skip to content

Commit

Permalink
* Fixed bug in *Copy to...* feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pulover committed Jun 9, 2016
1 parent 065fc8d commit 16fe05e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 63 deletions.
1 change: 1 addition & 0 deletions Documentation/About.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Thiago Talma for some improvements to the code, debugging and many suggestions.

* Fixed missing value field in exported `Control` and `ControlGet` commands.
* Fixed hidden *Main Loop* band reappearing after gui resize or minimizing/maximizing.
* Fixed bug in *Copy to...* feature.
* Fixed *Delete* key not working as hotkey.

## Version 5.0.2
Expand Down
51 changes: 1 addition & 50 deletions LIB/Class_LV_Rows.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
; Delete()
; Move([Up])
; Drag([DragButton, AutoScroll, ScrollDelay, LineThick, Color])
; CopyTo(Hwnd)
; MoveTo(Hwnd)
;
; History Functions:
; Add()
Expand Down Expand Up @@ -624,53 +622,6 @@ Class LV_Rows extends LV_Rows.LV_EX
return LV_currRow
}
;=======================================================================================
; Function: Handle.CopyTo()
; Description: Copies selected rows to a different ListView (requires initializing).
; Parameters:
; Hwnd: The Hwnd of a previously inserted ListView.
; Return: Number of copied rows.
;=======================================================================================
CopyTo(Hwnd)
{
If (!this.hArray.HasKey(Hwnd))
return false
CurrentHwnd := this.LVHwnd
, CopyData := this.CopyData.Clone()
, CopiedLines := this.Copy()
, this.SetHwnd(Hwnd)
, this.Paste()
, this.CopyData := CopyData.Clone()
, CopyData.RemoveAt(1, CopyData.Length())
, CopyData := ""
, this.RefreshGroups()
, this.SetHwnd(CurrentHwnd)
return CopiedLines
}
;=======================================================================================
; Function: Handle.MoveTo()
; Description: Copies selected rows to a different ListView
; and deletes them from the original (requires initializing).
; Parameters:
; Hwnd: The Hwnd of a previously inserted ListView.
; Return: Number of copied rows.
;=======================================================================================
MoveTo(Hwnd)
{
If (!this.hArray.HasKey(Hwnd))
return false
CurrentHwnd := this.LVHwnd
, CopyData := this.CopyData.Clone()
, CopiedLines := this.Cut()
, this.SetHwnd(Hwnd)
, this.Paste()
, this.CopyData := CopyData.Clone()
, CopyData.RemoveAt(1, CopyData.Length())
, CopyData := ""
, this.RefreshGroups()
, this.SetHwnd(CurrentHwnd)
return CopiedLines
}
;=======================================================================================
; History Functions: Keep a history of ListView changes and allow Undo and Redo.
; These functions operate on the currently selected ListView.
;=======================================================================================
Expand Down Expand Up @@ -1219,7 +1170,7 @@ Class LV_Rows extends LV_Rows.LV_EX
LVGS := OS > 5 ? LVGS6 : LVGS5
For Each, State In States {
If (State = "")
continue
continue
If !LVGS.HasKey(State)
Return false
SetStates |= LVGS[State]
Expand Down
2 changes: 1 addition & 1 deletion LIB/WordList.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SyHi_Fun = _addref _clone _getaddress _getcapacity _insert _maxindex _minindex _

SyHi_Flow = break catch continue critical else exit exitapp finally for gosub goto if ifequal ifexist ifgreater ifgreaterorequal ifinstring ifless iflessorequal ifmsgbox ifnotequal ifnotexist ifnotinstring ifwinactive ifwinexist ifwinnotactive ifwinnotexist loop onexit pause reload return setbatchlines settimer sleep suspend thread throw try until while

SyHi_Keyw = abort abovenormal activex add ahk_class ahk_group ahk_id ahk_pid all alnum alpha altsubmit alttab alttabandmenu alttabmenu alttabmenudismiss alwaysontop and astr ateof autosize background backgroundtrans base belownormal between bitand bitnot bitor bitshiftleft bitshiftright bitxor bold border bottom bottom break barbreak button buttons byref cancel cancel capacity caption caret center center char charp check check3 checkbox checked checkedgray choice choose choosestring class clone close color combobox contains controllist controllisthwnd count currentcol currentline custom date datetime days ddl default delete deleteall delimiter deref destroy digit disable disabled double doublep dropdownlist edit editpaste eject enable enabled encoding error exist exit expand exstyle files filesystem findstring first flash float float floatp focus focusv font force fromcodepage global grid group groupbox guiclose guicontextmenu guidropfiles guiescape guisize hdr hidden hide hidedropdown high hkcc hkcr hkcu hkey_classes_root hkey_current_config hkey_current_user hkey_local_machine hkey_users hklm hku horz hotkey hours hscroll hwnd icon iconsmall id idlast ignore imagelist in int int64 int64p integer integerfast interrupt intp is italic join label lastfound lastfoundexist left length limit linecount line lines link list listbox listview local localsameasglobal lock logoff low lower lowercase ltrim mainwindow margin maximize maximizebox menu minimize minimizebox minmax minutes monitorcount monitorname monitorprimary monitorworkarea monthcal mouse mousemove mousemoveoff move movedraw multi na name no noactivate nodefault nohide noicon nomainwindow norm normal nosort nosorthdr nostandard not notab notimers number number off ok on or owndialogs owner parse password password pic picture pid pixel pos pow priority processname progress ptr radio range read readonly realtime redraw reg_binary reg_dword reg_dword_big_endian reg_expand_sz reg_full_resource_descriptor reg_link reg_multi_sz reg_qword reg_resource_list reg_resource_requirements_list reg reg_sz regex region relative reload rename report resize restore retry rgb right rtrim screen seconds selected section section send sendandmouse serial setlabel shiftalttab short shortp show showdropdown shutdown single slider sortdesc standard static status statusbar statuscd str strike style submit sysmenu tab tab2 tableft tabright tabstop text text theme tile time tip tocodepage togglecheck toggleenable toolwindow top top topmost transcolor transparent tray treeview type uchar ucharp uint uint64 uint64p uintp uncheck underline unicode unlock updown upper uppercase useerrorlevel useunsetglobal useunsetlocal ushort ushortp vis visfirst visible vscroll wait waitclose wantctrla wantf2 wantreturn wanttab wrap wstr xdigit xm xp xs yes ym yp ys
SyHi_Keyw = abort abovenormal activex add ahk_class ahk_group ahk_id ahk_pid all alnum alpha altsubmit alttab alttabandmenu alttabmenu alttabmenudismiss alwaysontop and astr ateof autosize background backgroundtrans base belownormal between bitand bitnot bitor bitshiftleft bitshiftright bitxor bold border bottom bottom break barbreak button buttons byref cancel cancel capacity caption caret center center char charp check check3 checkbox checked checkedgray choice choose choosestring class clone close color combobox contains controllist controllisthwnd count currentcol currentline custom date datetime days ddl default delete deleteall delimiter deref destroy digit disable disabled double doublep dropdownlist edit editpaste eject enable enabled encoding error exist exit expand exstyle files filesystem findstring first flash float float floatp focus focusv font force fromcodepage global grid group groupbox guiclose guicontextmenu guidropfiles guiescape guisize hdr hidden hide hidedropdown high hkcc hkcr hkcu hkey_classes_root hkey_current_config hkey_current_user hkey_local_machine hkey_users hklm hku horz hotkey hours hscroll hwnd icon iconsmall id idlast ignore imagelist in int int64 int64p integer integerfast interrupt intp is italic join label lastfound lastfoundexist left length limit linecount line lines link list listbox listview local localsameasglobal lock logoff low lower lowercase ltrim mainwindow margin maximize maximizebox menu minimize minimizebox minmax minutes monitorcount monitorname monitorprimary monitorworkarea monthcal mouse mousemove mousemoveoff move movedraw multi na name no noactivate nodefault nohide noicon nomainwindow norm normal nosort nosorthdr nostandard not notab notimers number number off ok on or owndialogs owner parse password password pic picture pid pixel pos pow priority processname progress ptr radio range read readonly realtime redraw reg_binary reg_dword reg_dword_big_endian reg_expand_sz reg_full_resource_descriptor reg_link reg_multi_sz reg_qword reg_resource_list reg_resource_requirements_list reg reg_sz regex region relative reload rename report resize restore retry rgb right rtrim screen seconds selected section section send sendandmouse serial setlabel shiftalttab short shortp show showdropdown shutdown single slider sortdesc standard static status statusbar statuscd str strike style submit sysmenu tab tab2 tab3 tableft tabright tabstop text text theme tile time tip tocodepage togglecheck toggleenable toolwindow top top topmost transcolor transparent tray treeview type uchar ucharp uint uint64 uint64p uintp uncheck underline unicode unlock updown upper uppercase useerrorlevel useunsetglobal useunsetlocal ushort ushortp vis visfirst visible vscroll wait waitclose wantctrla wantf2 wantreturn wanttab wrap wstr xdigit xm xp xs yes ym yp ys

SyHi_BIVar = a_ahkpath a_ahkversion a_appdata a_appdatacommon a_autotrim a_batchlines a_caretx a_carety a_computername a_controldelay a_coordmodecaret a_coordmodemenu a_coordmodemouse a_coordmodepixel a_coordmodetooltip a_cursor a_dd a_ddd a_dddd a_defaultgui a_defaultlistview a_defaultmousespeed a_defaulttreeview a_desktop a_desktopcommon a_detecthiddentext a_detecthiddenwindows a_endchar a_eventinfo a_exitreason a_fileencoding a_formatfloat a_formatinteger a_gui a_guicontrol a_guicontrolevent a_guievent a_guiheight a_guiwidth a_guix a_guiy a_hour a_iconfile a_iconhidden a_iconnumber a_icontip a_index a_ipaddress1 a_ipaddress2 a_ipaddress3 a_ipaddress4 a_is64bitos a_isadmin a_iscompiled a_iscritical a_ispaused a_issuspended a_isunicode a_keydelay a_keydelayplay a_keyduration a_keydurationplay a_language a_lasterror a_linefile a_linenumber a_loopfield a_loopfileattrib a_loopfiledir a_loopfileext a_loopfilefullpath a_loopfilelongpath a_loopfilename a_loopfileshortname a_loopfileshortpath a_loopfilesize a_loopfilesizekb a_loopfilesizemb a_loopfiletimeaccessed a_loopfiletimecreated a_loopfiletimemodified a_loopreadline a_loopregkey a_loopregname a_loopregsubkey a_loopregtimemodified a_loopregtype a_mday a_min a_mm a_mmm a_mmmm a_mon a_mousedelay a_mousedelayplay a_msec a_mydocuments a_now a_nowutc a_numbatchlines a_ostype a_osversion a_priorhotkey a_priorkey a_programfiles a_programs a_programscommon a_ptrsize a_regview a_screendpi a_screenheight a_screenwidth a_scriptdir a_scriptfullpath a_scripthwnd a_scriptname a_sec a_sendlevel a_sendmode a_space a_startmenu a_startmenucommon a_startup a_startupcommon a_storecapslockmode a_stringcasesense a_tab a_temp a_thisfunc a_thishotkey a_thislabel a_thismenu a_thismenuitem a_thismenuitempos a_tickcount a_timeidle a_timeidlephysical a_timesincepriorhotkey a_timesincethishotkey a_titlematchmode a_titlematchmodespeed a_username a_wday a_windelay a_windir a_workingdir a_yday a_year a_yweek a_yyyy clipboard clipboardall comspec errorlevel false programfiles true

Expand Down
61 changes: 49 additions & 12 deletions MacroCreator.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -1347,9 +1347,10 @@ return
BuildMacroWin:
Gui, chMacro:+LastFound
Gui, chMacro:+hwndhMacroCh -Caption +Parent1
Gui, chMacro:Add, Tab2, Section Buttons 0x0008 -Wrap AltSubmit y+0 H22 hwndTabSel vA_List gTabSel, Macro1
Gui, chMacro:Add, Button, -Wrap y+0 W25 H23 hwndhMacrosMenu vMacrosMenu gMacrosMenu, ▼
Gui, chMacro:Add, Tab2, Section Buttons 0x0008 -Wrap AltSubmit yp H22 hwndTabSel vA_List gTabSel, Macro1
; LV0x10000 = LVS_EX_DOUBLEBUFFER
Gui, chMacro:Add, ListView, AltSubmit Checked x+0 y+0 hwndListID1 vInputList1 gInputList NoSort LV0x10000 LV0x4000, %w_Lang030%|%w_Lang031%|%w_Lang032%|%w_Lang033%|%w_Lang034%|%w_Lang035%|%w_Lang036%|%w_Lang037%|%w_Lang038%|%w_Lang039%
Gui, chMacro:Add, ListView, AltSubmit Checked xs+0 y+0 hwndListID1 vInputList1 gInputList NoSort LV0x10000 LV0x4000, %w_Lang030%|%w_Lang031%|%w_Lang032%|%w_Lang033%|%w_Lang034%|%w_Lang035%|%w_Lang036%|%w_Lang037%|%w_Lang038%|%w_Lang039%
Gui, chMacro:Default
LV_SetImageList(hIL_Icons)
Loop, 10
Expand Down Expand Up @@ -11475,20 +11476,48 @@ Gosub, PrevRefresh
return

CopyList:
If (IsMacrosMenu)
{
GuiControl, chMacro:Choose, A_List, %A_ThisMenuItemPos%
GoSub, TabSel
return
}
Critical
Gui, chMacro:Default
Gui, chMacro:Submit, NoHide
Gui, chMacro:ListView, InputList%A_List%
LVManager.CopyTo(ListID%A_ThisMenuItemPos%)
Gui, chMacro:ListView, InputList%A_ThisMenuItemPos%
LVManager.SetHwnd(ListID%A_ThisMenuItemPos%)
c_List := A_List, A_List := A_ThisMenuItemPos
GoSub, RowCheck
s_List := A_List, d_List := A_ThisMenuItemPos, RowSelection := LV_GetCount("Selected")
RowNumber := 0
If RowSelection = 0
{
Loop, % ListCount%s_List%
{
RowNumber++
Gui, chMacro:ListView, InputList%s_List%
LV_GetTexts(RowNumber, Action, Details, TimesX, DelayX, Type, Target, Window, Comment, Color)
ckd := (LV_GetNext(RowNumber-1, "Checked")=RowNumber) ? 1 : 0
Gui, chMacro:ListView, InputList%d_List%
LV_Add("Check" ckd, ListCount%d_List%+1, Action, Details, TimesX, DelayX, Type, Target, Window, Comment, Color)
}
}
Else
{
Loop, %RowSelection%
{
Gui, chMacro:ListView, InputList%s_List%
RowNumber := LV_GetNext(RowNumber)
LV_GetTexts(RowNumber, Action, Details, TimesX, DelayX, Type, Target, Window, Comment, Color)
ckd := (LV_GetNext(RowNumber-1, "Checked")=RowNumber) ? 1 : 0
Gui, chMacro:ListView, InputList%d_List%
LV_Add("Check" ckd, ListCount%d_List%+1, Action, Details, TimesX, DelayX, Type, Target, Window, Comment, Color)
}
}
Gui, chMacro:ListView, InputList%d_List%
ListCount%d_List% := LV_GetCount()
HistCheck()
GoSub, b_Enable
A_List := c_List
Gui, chMacro:ListView, InputList%A_List%
LVManager.SetHwnd(ListID%A_List%)
GoSub, RowCheck
Gui, chMacro:ListView, InputList%s_List%
GuiControl, Focus, InputList%A_List%
return

Duplicate:
Expand Down Expand Up @@ -11804,6 +11833,13 @@ Menu, FuncMenu, Enable, %u_Lang004%`t%_s%Ctrl+Shift+C
TB_Edit(TbEdit, "FuncParameter",, 0), TB_Edit(TbEdit, "FuncReturn",, 0)
return

MacrosMenu:
IsMacrosMenu := true
ControlGetPos, CtrPosX, CtrPosY,, CtrlPosH,, ahk_id %hMacrosMenu%
Menu, CopyTo, Show, %CtrPosX%, % CtrPosY + CtrlPosH
IsMacrosMenu := false
return

SaveData:
Gui, 1:Default
If ((A_GuiControl = "AutoKey") || (A_GuiControl = "TimesG"))
Expand Down Expand Up @@ -14822,7 +14858,8 @@ return
chMacroGuiSize:
GuiGetSize(GuiWidth, GuiHeight, "chMacro")
GuiControl, chMacro:Move, InputList%A_List%, % "W" GuiWidth-15 "H" GuiHeight-25
GuiControl, chMacro:Move, A_List, % "W" GuiWidth-15
GuiControl, chMacro:Move, A_List, % "W" GuiWidth-40
GuiControl, chMacro:Move, MacrosMenu, % "X" GuiWidth-29
return

GuiSize:
Expand Down

0 comments on commit 16fe05e

Please sign in to comment.