Skip to content

Commit

Permalink
[Features] (#260, #261, #262, #263, #264, #265, #266, #267), version …
Browse files Browse the repository at this point in the history
…1.1.2.2
  • Loading branch information
Hofknecht committed Dec 9, 2021
1 parent 8233667 commit 4fad5b1
Show file tree
Hide file tree
Showing 16 changed files with 443 additions and 886 deletions.
130 changes: 78 additions & 52 deletions Business/KeyboardInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,70 +368,26 @@ private void SelectByKey(Keys keys, string keyInput = "", bool keepSelection = f

break;
case Keys.Left:
int iMenuKeyNext = iMenuKey + 1;
if (isStillSelected)
bool nextMenuLocationIsLeft = menus[iMenuKey + 1] != null && menus[iMenuKey + 1].Location.X < menus[iMenuKey].Location.X;
if (nextMenuLocationIsLeft)
{
if (menuFromSelected != null &&
menuFromSelected == menus[iMenuKeyNext])
{
dgv = menuFromSelected.GetDataGridView();
if (dgv.Rows.Count > 0)
{
iMenuKey += 1;
iRowKey = -1;
if (SelectMatched(dgv, iRowKey) ||
SelectMatched(dgv, 0))
{
RowDeselected(iRowBefore, dgvBefore);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
}
SelectNextMenu(iRowBefore, ref dgv, dgvBefore, menuFromSelected, isStillSelected, ref toClear);
}
else
{
iRowKey = -1;
iMenuKey = menus.Where(m => m != null).Count() - 1;
if (menus[iMenuKey] != null)
{
dgv = menus[iMenuKey].GetDataGridView();
if (SelectMatched(dgv, iRowKey) ||
SelectMatched(dgv, 0))
{
RowDeselected(iRowBefore, dgvBefore);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
SelectPreviousMenu(iRowBefore, ref menu, ref dgv, dgvBefore, ref toClear);
}

break;
case Keys.Right:
if (iMenuKey > 0)
bool nextMenuLocationIsRight = menus[iMenuKey + 1] != null && menus[iMenuKey + 1].Location.X > menus[iMenuKey].Location.X;
if (nextMenuLocationIsRight)
{
if (menus[iMenuKey - 1] != null)
{
iMenuKey -= 1;
iRowKey = -1;
menu = menus[iMenuKey];
dgv = menu.GetDataGridView();
if (SelectMatched(dgv, dgv.SelectedRows[0].Index) ||
SelectMatched(dgv, 0))
{
RowDeselected(iRowBefore, dgvBefore);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
SelectNextMenu(iRowBefore, ref dgv, dgvBefore, menuFromSelected, isStillSelected, ref toClear);
}
else
{
RowDeselected(iRowBefore, dgvBefore);
iMenuKey = 0;
iRowKey = -1;
toClear = true;
Cleared?.Invoke();
SelectPreviousMenu(iRowBefore, ref menu, ref dgv, dgvBefore, ref toClear);
}

break;
Expand Down Expand Up @@ -477,6 +433,76 @@ private void SelectByKey(Keys keys, string keyInput = "", bool keepSelection = f
}
}

private void SelectPreviousMenu(int iRowBefore, ref Menu menu, ref DataGridView dgv, DataGridView dgvBefore, ref bool toClear)
{
if (iMenuKey > 0)
{
if (menus[iMenuKey - 1] != null)
{
iMenuKey -= 1;
iRowKey = -1;
menu = menus[iMenuKey];
dgv = menu.GetDataGridView();
if (SelectMatched(dgv, dgv.SelectedRows[0].Index) ||
SelectMatched(dgv, 0))
{
RowDeselected(iRowBefore, dgvBefore);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
}
else
{
RowDeselected(iRowBefore, dgvBefore);
iMenuKey = 0;
iRowKey = -1;
toClear = true;
Cleared?.Invoke();
}
}

private void SelectNextMenu(int iRowBefore, ref DataGridView dgv, DataGridView dgvBefore, Menu menuFromSelected, bool isStillSelected, ref bool toClear)
{
int iMenuKeyNext = iMenuKey + 1;
if (isStillSelected)
{
if (menuFromSelected != null &&
menuFromSelected == menus[iMenuKeyNext])
{
dgv = menuFromSelected.GetDataGridView();
if (dgv.Rows.Count > 0)
{
iMenuKey += 1;
iRowKey = -1;
if (SelectMatched(dgv, iRowKey) ||
SelectMatched(dgv, 0))
{
RowDeselected(iRowBefore, dgvBefore);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
}
}
else
{
iRowKey = -1;
iMenuKey = menus.Where(m => m != null).Count() - 1;
if (menus[iMenuKey] != null)
{
dgv = menus[iMenuKey].GetDataGridView();
if (SelectMatched(dgv, iRowKey) ||
SelectMatched(dgv, 0))
{
RowDeselected(iRowBefore, dgvBefore);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
}
}

private void SelectRow(DataGridView dgv, int iRowKey)
{
InUse = true;
Expand Down
19 changes: 17 additions & 2 deletions Business/Menus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void CreateAndShowLoadingMenu(RowData rowData)
Level = rowData.MenuLevel + 1,
};

Menu menuLoading = Create(menuDataLoading, Path.GetFileName(Config.Path));
Menu menuLoading = Create(menuDataLoading, Path.GetFileName(rowData.TargetFilePathOrig));
menuLoading.IsLoadingMenu = true;
AdjustMenusSizeAndLocation();
menus[rowData.MenuLevel + 1] = menuLoading;
Expand Down Expand Up @@ -217,8 +217,10 @@ void LoadSubMenuCompleted(object senderCompleted, RunWorkerCompletedEventArgs e)
MenuData menuData = (MenuData)e.Result;

Menu menuLoading = menus[menuData.Level];
string userSearchText = string.Empty;
if (menuLoading != null && menuLoading.IsLoadingMenu)
{
userSearchText = menuLoading.GetSearchText();
menuLoading.HideWithFade();
menus[menuLoading.Level] = null;
}
Expand All @@ -245,6 +247,10 @@ void LoadSubMenuCompleted(object senderCompleted, RunWorkerCompletedEventArgs e)
if (menus[0].IsUsable)
{
ShowSubMenu(menu);
if (!string.IsNullOrEmpty(userSearchText))
{
menu.SetSearchText(userSearchText);
}
}
}
}
Expand Down Expand Up @@ -1232,6 +1238,12 @@ private void AdjustMenusSizeAndLocation()
{
screenBounds = Screen.FromPoint(Cursor.Position).Bounds;
}
else if (Properties.Settings.Default.UseCustomLocation)
{
screenBounds = Screen.FromPoint(new Point(
Properties.Settings.Default.CustomLocationX,
Properties.Settings.Default.CustomLocationY)).Bounds;
}
else
{
screenBounds = Screen.PrimaryScreen.Bounds;
Expand Down Expand Up @@ -1292,7 +1304,10 @@ private void AdjustMenusSizeAndLocation()
menu.AdjustSizeAndLocation(screenBounds, menuPredecessor, startLocation);
}

if (i == 0)
if (!Properties.Settings.Default.AppearAtTheBottomLeft &&
!Properties.Settings.Default.AppearAtMouseLocation &&
!Properties.Settings.Default.UseCustomLocation &&
i == 0)
{
const int overlapTolerance = 4;

Expand Down
8 changes: 0 additions & 8 deletions Config/AppColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ internal static class AppColors

public static Color DarkModeOpenFolderBorder { get; set; }

public static Color Warning { get; set; }

public static Color DarkModeWarning { get; set; }

public static Color Title { get; set; }

public static Color DarkModeTitle { get; set; }

public static Color Background { get; set; }

public static Color DarkModeBackground { get; set; }
Expand Down
24 changes: 0 additions & 24 deletions Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,30 +214,6 @@ internal static void InitializeColors(bool save = true)
Settings.Default.ColorDarkModeOpenFolderBorder = colorAndCode.HtmlColorCode;
AppColors.DarkModeOpenFolderBorder = colorAndCode.Color;

colorAndCode.HtmlColorCode = Settings.Default.ColorWarning;
colorAndCode.Color = Color.FromArgb(255, 204, 232);
colorAndCode = ProcessColorAndCode(converter, colorAndCode, ref changed);
Settings.Default.ColorWarning = colorAndCode.HtmlColorCode;
AppColors.Warning = colorAndCode.Color;

colorAndCode.HtmlColorCode = Settings.Default.ColorDarkModeWarning;
colorAndCode.Color = Color.FromArgb(75, 24, 52);
colorAndCode = ProcessColorAndCode(converter, colorAndCode, ref changed);
Settings.Default.ColorDarkModeWarning = colorAndCode.HtmlColorCode;
AppColors.DarkModeWarning = colorAndCode.Color;

colorAndCode.HtmlColorCode = Settings.Default.ColorTitle;
colorAndCode.Color = Color.Azure;
colorAndCode = ProcessColorAndCode(converter, colorAndCode, ref changed);
Settings.Default.ColorTitle = colorAndCode.HtmlColorCode;
AppColors.Title = colorAndCode.Color;

colorAndCode.HtmlColorCode = Settings.Default.ColorDarkModeTitle;
colorAndCode.Color = Color.FromArgb(43, 43, 43);
colorAndCode = ProcessColorAndCode(converter, colorAndCode, ref changed);
Settings.Default.ColorDarkModeTitle = colorAndCode.HtmlColorCode;
AppColors.DarkModeTitle = colorAndCode.Color;

colorAndCode.HtmlColorCode = Settings.Default.ColorIcons;
colorAndCode.Color = Color.FromArgb(149, 160, 166);
colorAndCode = ProcessColorAndCode(converter, colorAndCode, ref changed);
Expand Down
45 changes: 0 additions & 45 deletions Config/MenuDefines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,51 +72,6 @@ public static Color ColorOpenFolderBorder
}
}

public static Color ColorTitleWarning
{
get
{
if (Config.IsDarkMode())
{
return AppColors.DarkModeWarning;
}
else
{
return AppColors.Warning;
}
}
}

public static Color ColorTitleSelected
{
get
{
if (Config.IsDarkMode())
{
return AppColors.DarkModeSelecetedItem;
}
else
{
return AppColors.SelectedItem;
}
}
}

public static Color ColorTitleBackground
{
get
{
if (Config.IsDarkMode())
{
return AppColors.DarkModeTitle;
}
else
{
return AppColors.Title;
}
}
}

public static Color ColorIcons
{
get
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2.1")]
[assembly: AssemblyFileVersion("1.1.2.1")]
[assembly: AssemblyVersion("1.1.2.2")]
[assembly: AssemblyFileVersion("1.1.2.2")]
Loading

0 comments on commit 4fad5b1

Please sign in to comment.