From 8f887a770ac82de8d5c023301c1fe8111363c917 Mon Sep 17 00:00:00 2001 From: veroxzik <43590004+veroxzik@users.noreply.github.com> Date: Thu, 28 Apr 2022 21:56:05 -0400 Subject: [PATCH] Cursor changes. Cursor is now two thin lines. Adds View menu item containing various show/hide options for the cursor. --- BAKKA Editor/MyForm.h | 70 ++++++++++++++++++++++++++++++++-------- BAKKA Editor/MyForm.resx | 41 +++++++++++++++++++---- 2 files changed, 90 insertions(+), 21 deletions(-) diff --git a/BAKKA Editor/MyForm.h b/BAKKA Editor/MyForm.h index 49a186a..b6fa2b8 100644 --- a/BAKKA Editor/MyForm.h +++ b/BAKKA Editor/MyForm.h @@ -338,6 +338,9 @@ private: System::Windows::Forms::Panel^ panel1; private: System::Windows::Forms::NumericUpDown^ PlaybackSpeedNum; private: System::Windows::Forms::Label^ label30; private: System::Windows::Forms::CheckBox^ HighlightCheckBox; +private: System::Windows::Forms::ToolStripMenuItem^ viewToolStripMenuItem; +private: System::Windows::Forms::ToolStripMenuItem^ showCursorToolStripMenuItem; +private: System::Windows::Forms::ToolStripMenuItem^ showCursorDuringPlaybackToolStripMenuItem; @@ -401,6 +404,8 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->saveAsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); + this->showCursorToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->TapButton = (gcnew System::Windows::Forms::Button()); this->OrangeButton = (gcnew System::Windows::Forms::Button()); @@ -540,7 +545,7 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker()); this->backgroundWorker2 = (gcnew System::ComponentModel::BackgroundWorker()); this->panel1 = (gcnew System::Windows::Forms::Panel()); - //this->timer1 = (gcnew System::Windows::Forms::Timer(this->components)); + this->showCursorDuringPlaybackToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem()); this->menuStrip->SuspendLayout(); this->NoteTypeBox->SuspendLayout(); (cli::safe_cast(this->VisualHispeed))->BeginInit(); @@ -588,9 +593,9 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; // menuStrip // this->menuStrip->ImageScalingSize = System::Drawing::Size(24, 24); - this->menuStrip->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) { + this->menuStrip->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) { this->fileToolStripMenuItem, - this->aboutToolStripMenuItem + this->viewToolStripMenuItem, this->aboutToolStripMenuItem }); resources->ApplyResources(this->menuStrip, L"menuStrip"); this->menuStrip->Name = L"menuStrip"; @@ -634,6 +639,23 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; resources->ApplyResources(this->exitToolStripMenuItem, L"exitToolStripMenuItem"); this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::exitToolStripMenuItem_Click); // + // viewToolStripMenuItem + // + this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) { + this->showCursorToolStripMenuItem, + this->showCursorDuringPlaybackToolStripMenuItem + }); + this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem"; + resources->ApplyResources(this->viewToolStripMenuItem, L"viewToolStripMenuItem"); + // + // showCursorToolStripMenuItem + // + this->showCursorToolStripMenuItem->Checked = true; + this->showCursorToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Checked; + this->showCursorToolStripMenuItem->Name = L"showCursorToolStripMenuItem"; + resources->ApplyResources(this->showCursorToolStripMenuItem, L"showCursorToolStripMenuItem"); + this->showCursorToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::showCursorToolStripMenuItem_Click); + // // aboutToolStripMenuItem // this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem"; @@ -1653,11 +1675,11 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; this->panel1->Controls->Add(this->CurrentObjectText); this->panel1->Name = L"panel1"; // - // timer1 + // showCursorDuringPlaybackToolStripMenuItem // - //this->timer1->Enabled = true; - //this->timer1->Interval = 20; - //this->timer1->Tick += gcnew System::EventHandler(this, &MyForm::timer1_Tick); + this->showCursorDuringPlaybackToolStripMenuItem->Name = L"showCursorDuringPlaybackToolStripMenuItem"; + resources->ApplyResources(this->showCursorDuringPlaybackToolStripMenuItem, L"showCursorDuringPlaybackToolStripMenuItem"); + this->showCursorDuringPlaybackToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::showCursorDuringPlaybackToolStripMenuItem_Click); // // MyForm // @@ -3778,6 +3800,7 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; float widthOfBasePen = (float)CirclePanel->Width * (4.f / 600.f); //sizes are essentially the pixel width if the box is 600x600 float widthOfLinesPen = (float)CirclePanel->Width * (2.f / 600.f); float widthOfNotePen = (float)CirclePanel->Width * (8.f / 600.f); + float widthOfCurrentNotePen = (float)CirclePanel->Width * (4.f / 600.f); float widthOfMeasurePen = (float)CirclePanel->Width * (1.f / 600.f); float highlightWidth = (float)CirclePanel->Width * (5.f / 600.f); float baseLineLength = (float)CirclePanel->Width * (10.f / 285.f); //10 pixels if box is 285x285 @@ -3793,9 +3816,9 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; SolidBrush^ MaskBrush = gcnew SolidBrush(Color::DimGray); SolidBrush^ MaskRemoveBrush = gcnew SolidBrush(Color::White); //Circle location and size - float xPos = widthOfNotePen; - float yPos = widthOfNotePen; - float sizeOfRect = CirclePanel->Width - (widthOfNotePen*2); + float xPos = widthOfNotePen*2; + float yPos = widthOfNotePen*2; + float sizeOfRect = CirclePanel->Width - (widthOfNotePen*4); //Circle info float circleRadius = ((float)sizeOfRect / 2); float xCenterOfCircle = circleRadius + xPos; @@ -4041,13 +4064,24 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; notemapitr--; } } - + + // Generate flag for showing cursor + bool showCursor = showCursorToolStripMenuItem->Checked; + if (currentlyPlayingSong != nullptr) { + if (!currentlyPlayingSong->Paused) { + showCursor = showCursorDuringPlaybackToolStripMenuItem->Checked; + } + } //Draw selected note - if (SelectedLineType == 1 && Rect.Width >= 1) { + if (SelectedLineType == 1 && Rect.Width >= 1 && showCursor) { CircleNotePen->Color = returnColor(SelectedNoteTypeVisual); - CircleNotePen->Width = widthOfNotePen; - bufferedGfx->Graphics->DrawArc(CircleNotePen, Rect, startAngle, arcLength); + CircleNotePen->Width = widthOfCurrentNotePen; + float spacing = widthOfNotePen + widthOfCurrentNotePen; + Rectangle innerRect(Rect.X + spacing, Rect.Y + spacing, Rect.Width - spacing * 2, Rect.Height - spacing * 2); + Rectangle outerRect(Rect.X - spacing, Rect.Y - spacing, Rect.Width + spacing * 2, Rect.Height + spacing * 2); + bufferedGfx->Graphics->DrawArc(CircleNotePen, innerRect, startAngle, arcLength); + bufferedGfx->Graphics->DrawArc(CircleNotePen, outerRect, startAngle, arcLength); } //Render @@ -4116,6 +4150,7 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; if (backgroundWorkerSong->IsBusy) { backgroundWorkerSong->CancelAsync(); } + RefreshPaint(); } else { PlayButton->Text = "Pause (P)"; @@ -4353,5 +4388,12 @@ private: System::Windows::Forms::CheckBox^ HighlightCheckBox; DrawToGraphics(bufferedGfx->Graphics); } */ +private: System::Void showCursorToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + showCursorToolStripMenuItem->Checked = !showCursorToolStripMenuItem->Checked; + RefreshPaint(); +} +private: System::Void showCursorDuringPlaybackToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { + showCursorDuringPlaybackToolStripMenuItem->Checked = !showCursorDuringPlaybackToolStripMenuItem->Checked; +} }; } diff --git a/BAKKA Editor/MyForm.resx b/BAKKA Editor/MyForm.resx index 90935bd..e12786c 100644 --- a/BAKKA Editor/MyForm.resx +++ b/BAKKA Editor/MyForm.resx @@ -170,6 +170,24 @@ File + + 230, 22 + + + Show Cursor + + + 230, 22 + + + Show Cursor During Playback + + + 44, 20 + + + View + 52, 20 @@ -4244,6 +4262,18 @@ Viewed Note System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + viewToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + showCursorToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + aboutToolStripMenuItem @@ -4304,11 +4334,11 @@ Viewed Note System.ComponentModel.BackgroundWorker, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - timer1 + + showCursorDuringPlaybackToolStripMenuItem - - System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MyForm @@ -4334,7 +4364,4 @@ Viewed Note 181, 59 - - 345, 59 - \ No newline at end of file -- 2.54.0