Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added copy to clipboard functionality and a few hotkeys. #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,832 changes: 916 additions & 916 deletions src/CymaticLabs.InfluxDB.Studio/AppForm.Designer.cs

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/CymaticLabs.InfluxDB.Studio/Controls/ExtendedTabControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ private void ExtendedTabControl_MouseUp(object sender, MouseEventArgs e)
// Now show the context menu
tabContextMenuStrip.Show(this, e.Location);
}
else if (e.Button == MouseButtons.Middle)
{
// Go through and get the tab that was middle-clicked
Point p = PointToClient(Cursor.Position);
for (int i = 0; i < TabCount; i++)
{
r = GetTabRect(i);

if (r.Contains(p))
{
CloseTab(TabPages[i]);
break;
}
}
}
}

// Handles click of tab context menu "Close"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions src/CymaticLabs.InfluxDB.Studio/Controls/QueryControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,22 @@ public override async Task ExecuteRequestAsync()

// Show stat results of query
resultsLabel.Text = string.Format("results: {0}, response time: {1:0} ms", resultsCount, stopWatch.Elapsed.TotalMilliseconds);
}

}
#endregion Methods

#region Event Handlers

private async void queryEditor_KeyUp(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.F5:
await ExecuteRequestAsync();
break;
}
}

#endregion Event Handlers
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 50 additions & 2 deletions src/CymaticLabs.InfluxDB.Studio/Controls/QueryResultsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,56 @@ void ExportToJson(bool onlySelected = false)
{
AppForm.DisplayException(ex);
}
}

}
#endregion Methods

private void listView_KeyUp(object sender, KeyEventArgs e)
{
if (sender != listView) return;

if (e.Control)
{
switch (e.KeyCode)
{
case Keys.A:
SelectedAll();
break;
case Keys.C:
CopySelectedToClipboard();
break;
}
}
}

private void SelectedAll()
{
foreach (ListViewItem li in listView.Items)
{
li.Selected = true;
}
}

private void CopySelectedToClipboard()
{
var sb = new StringBuilder();

foreach (ListViewItem li in listView.Items)
{
if (!li.Selected) continue;

// (skip first column which is just row # label)
for (var i = 1; i < li.SubItems.Count; i++)
{
var sli = li.SubItems[i];
sb.Append(sli.Text);
if (i < li.SubItems.Count - 1) sb.Append('\t');
}

sb.Append(Environment.NewLine);
}

Clipboard.SetText(sb.ToString());
}
}
}