Cursor on tool selection implemented

Forums

Hi Rui, if you want to incorporate it it seems to work fine.

I just had to add the setCursor to your implementation.
Attached is qtractorMidiEditorForm.cpp

___Note:
I have also implemented the click animation (2px cursor offset). Curiously, the cursor size had to be increased for it to work. It doesn't work with native icons but it does with the theme icons. This is certainly a minor thing, and also a bit of a mystery.
___

line 717

		if (!pOptions->bMidiEditMode) {
			m_ui.editModeOffAction->setChecked(true);
			m_pMidiEditor->unsetCursor();
		} else {
			if (!pOptions->bMidiEditModeDraw) {
				m_ui.editModeOnAction->setChecked(true);
				m_pMidiEditor->setCursor(QCursor(QIcon::fromTheme("editModeOn").pixmap(32), 3, 20));
			} else {
				m_ui.editModeDrawAction->setChecked(true);
				m_pMidiEditor->setCursor(QCursor(QIcon::fromTheme("editModeDraw").pixmap(32), 3, 20));
			}
		}

line 1579

// Toggle edit-mode on.
void qtractorMidiEditorForm::editModeOn ( bool bOn )
{
//	m_pMidiEditor->setEditModeDraw(false);
	if (bOn && m_pMidiEditor->isEditMode()
		&& !m_pMidiEditor->isEditModeDraw()) {
		m_ui.editModeOffAction->setChecked(true);
		m_pEditModeToolButton->setDefaultAction(
			m_pEditModeActionGroup->checkedAction());
		m_pMidiEditor->setEditMode(false);
		m_pMidiEditor->unsetCursor();

	} else {
		m_pMidiEditor->setEditModeDraw(!bOn);
		m_pMidiEditor->setEditMode(bOn);
		m_pMidiEditor->setCursor(QCursor(QIcon::fromTheme("editModeOn").pixmap(32), 3, 20));

	}
	m_pMidiEditor->updateContents();

	stabilizeForm();
}

// Toggle edit-mode off.
void qtractorMidiEditorForm::editModeOff ( bool bOn )
{
//	m_pMidiEditor->setEditModeDraw(false);
	if (bOn && !m_pMidiEditor->isEditMode()) {
		if (m_pMidiEditor->isEditModeDraw()) {
			m_ui.editModeDrawAction->setChecked(true);
			m_pMidiEditor->setCursor(QCursor(QIcon::fromTheme("editModeDraw").pixmap(32), 3, 20));
		} else {
			m_ui.editModeOnAction->setChecked(true);
			m_pMidiEditor->setCursor(QCursor(QIcon::fromTheme("editModeOn").pixmap(32), 3, 20));
		}
		m_pEditModeToolButton->setDefaultAction(
			m_pEditModeActionGroup->checkedAction());
		m_pMidiEditor->setEditMode(true);
	} else {
		m_pMidiEditor->setEditMode(!bOn);
		m_pMidiEditor->unsetCursor();
	}
	m_pMidiEditor->updateContents();

	stabilizeForm();
}


// Toggle draw-mode (notes)
void qtractorMidiEditorForm::editModeDraw ( bool bOn )
{
//	m_pMidiEditor->setEditModeDraw(bOn);
	if (bOn && m_pMidiEditor->isEditMode()
		&& m_pMidiEditor->isEditModeDraw()) {
		m_ui.editModeOnAction->setChecked(true);
		m_pMidiEditor->setCursor(QCursor(QIcon::fromTheme("editModeOn").pixmap(32), 3, 20));
		m_pEditModeToolButton->setDefaultAction(
			m_pEditModeActionGroup->checkedAction());
		m_pMidiEditor->setEditModeDraw(false);
	} else {
		m_pMidiEditor->setEditModeDraw(bOn);
		m_pMidiEditor->setCursor(QCursor(QIcon::fromTheme("editModeDraw").pixmap(32), 3, 20));
		m_pMidiEditor->setEditMode(bOn);
	}
	m_pMidiEditor->updateContents();

	stabilizeForm();
}
Permalink

hi, thanks

one thing, you'll need to test as well, is how the cursor behaves in presence to keyboard modifiers like [Shift] and/or [Ctrl] and whether it resets to correct shape when entering or leaving the modified mode, view panes, windows and what not...

IIRC. it used to get stuck on some erroneous cursor shape at random, which is far worse than the current status quo. :)

cheers

UPDATE: in a slightly different approach, yet applicable when hovering the proper view-ports only, please check qtractor >= 1.5.2.11git.74ae6e [develop]. thanks

It only updates when you move the mouse. And that can be confusing.
When you activate from keyboard shortcuts you get the feeling that the tool hasn't changed.

Could the new "setEditCursor" method be used from qtractorMidiEditorForm.cpp?

The same thing I've done but using the setEditCursor method instead of the generic setCursor, and so it would update with any changes immediately only in the areas it should.

I've tried it and it doesn't work... Getting it would be the perfect experience.
But if it can't be done, what's already there is a great improvement and I'm grateful :).

Add new comment

The content of this field is kept private and will not be shown publicly.

Markdown

  • Parses markdown and converts it to HTML.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id> <img src alt height width> <strike> <pre> <p> <br>
  • Lines and paragraphs break automatically.

Filtered HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <b> <i> <pre> <img src alt height width> <strike>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
File attachments
Unlimited number of files can be uploaded to this field.
2 MB limit.
Allowed types: jpg jpeg gif png txt doc docx xls xlsx pdf ppt pps odt ods odp zip gz bz2 xz patch diff wav ogg flac ogv mp4 qtz.