Beispiel #1
0
void TestKeycode::testCreateFromSKeyInput()
{
	KeyPress k;
	irr::SEvent::SKeyInput in;

	// Character key
	in.Key = irr::KEY_KEY_3;
	in.Char = L'3';
	k = KeyPress(in);
	UASSERTEQ_STR(k.sym(), "KEY_KEY_3");

	// Non-Character key
	in.Key = irr::KEY_RSHIFT;
	in.Char = L'\0';
	k = KeyPress(in);
	UASSERTEQ_STR(k.sym(), "KEY_RSHIFT");

	// Irrlicht-unknown key
	in.Key = irr::KEY_KEY_CODES_COUNT;
	in.Char = L'?';
	k = KeyPress(in);
	UASSERTEQ_STR(k.sym(), "?");

	// prefer_character mode
	in.Key = irr::KEY_COMMA;
	in.Char = L'G';
	k = KeyPress(in, true);
	UASSERTEQ_STR(k.sym(), "KEY_KEY_G");
}
    Scanner (PluginListComponent& plc,
             AudioPluginFormat& format,
             PropertiesFile* properties,
             int threads)
        : owner (plc), formatToScan (format), propertiesToUse (properties),
          pathChooserWindow (TRANS("Select folders to scan..."), String::empty, AlertWindow::NoIcon),
          progressWindow (TRANS("Scanning for plug-ins..."),
                          TRANS("Searching for all possible plug-in files..."), AlertWindow::NoIcon),
          progress (0.0), numThreads (threads), finished (false)
    {
        FileSearchPath path (formatToScan.getDefaultLocationsToSearch());

        if (path.getNumPaths() > 0) // if the path is empty, then paths aren't used for this format.
        {
            if (propertiesToUse != nullptr)
                path = getLastSearchPath (*propertiesToUse, formatToScan);

            pathList.setSize (500, 300);
            pathList.setPath (path);

            pathChooserWindow.addCustomComponent (&pathList);
            pathChooserWindow.addButton (TRANS("Scan"),   1, KeyPress (KeyPress::returnKey));
            pathChooserWindow.addButton (TRANS("Cancel"), 0, KeyPress (KeyPress::escapeKey));

            pathChooserWindow.enterModalState (true,
                ModalCallbackFunction::forComponent (startScanCallback, &pathChooserWindow, this),
                false);
        }
        else
        {
            startScan();
        }
    }
Beispiel #3
0
void TestKeycode::testCreateFromString()
{
	KeyPress k;

	// Character key, from char
	k = KeyPress("R");
	UASSERTEQ_STR(k.sym(), "KEY_KEY_R");
	UASSERTCMP(int, >, strlen(k.name()), 0); // should have human description

	// Character key, from identifier
	k = KeyPress("KEY_KEY_B");
	UASSERTEQ_STR(k.sym(), "KEY_KEY_B");
	UASSERTCMP(int, >, strlen(k.name()), 0);

	// Non-Character key, from identifier
	k = KeyPress("KEY_UP");
	UASSERTEQ_STR(k.sym(), "KEY_UP");
	UASSERTCMP(int, >, strlen(k.name()), 0);

	k = KeyPress("KEY_F6");
	UASSERTEQ_STR(k.sym(), "KEY_F6");
	UASSERTCMP(int, >, strlen(k.name()), 0);

	// Irrlicht-unknown key, from char
	k = KeyPress("/");
	UASSERTEQ_STR(k.sym(), "/");
	UASSERTCMP(int, >, strlen(k.name()), 0);
}
Beispiel #4
0
void MainWindow::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
    switch (commandID)
    {
        case CommandIDs::closeWindow:
            result.setInfo ("Close Window", "Closes the current window", CommandCategories::general, 0);
            result.defaultKeypresses.add (KeyPress ('w', ModifierKeys::commandModifier, 0));
            break;

        case CommandIDs::goToPreviousWindow:
            result.setInfo ("Previous Window", "Activates the previous window", CommandCategories::general, 0);
            result.setActive (ProjucerApplication::getApp().mainWindowList.windows.size() > 1);
            result.defaultKeypresses.add (KeyPress (KeyPress::tabKey, ModifierKeys::shiftModifier | ModifierKeys::ctrlModifier, 0));
            break;

        case CommandIDs::goToNextWindow:
            result.setInfo ("Next Window", "Activates the next window", CommandCategories::general, 0);
            result.setActive (ProjucerApplication::getApp().mainWindowList.windows.size() > 1);
            result.defaultKeypresses.add (KeyPress (KeyPress::tabKey, ModifierKeys::ctrlModifier, 0));
            break;

        default:
            break;
    }
}
Beispiel #5
0
void MainContentComponent::getCommandInfo (CommandID commandID, ApplicationCommandInfo& result)
{
    const String category ("General");

    switch (commandID)
    {
    case Ananke::menuFileOption:
        result.setInfo ("File", "Create a new synth graph", category, 0);
        result.defaultKeypresses.add (KeyPress ('n', ModifierKeys::commandModifier, 0));
        break;

    case Ananke::menuExitOption:
        result.setInfo ("Exit", "Exit out of application", category, 0);
        result.defaultKeypresses.add (KeyPress ('w', ModifierKeys::commandModifier, 0));
        break;

    case Ananke::menuSettingsOption:
        result.setInfo ("Settings", "Open settings window", category, 0);
        result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
        break;

    case Ananke::menuHelpOption:
        result.setInfo ("Help", "Open help file", category, 0);
        result.defaultKeypresses.add (KeyPress ('h', ModifierKeys::commandModifier, 0));
        break;
    }
}
Beispiel #6
0
PopupMenu MainContentComponent::getMenuForIndex( int menuIndex, const juce::String & )
{
	PopupMenu menu;

	if ( menuIndex == 0 )
	{
		menu.addItem( 1, "New Chaser" );
		menu.addSeparator();

		menu.addItem( 2, "Load Chaser" );
		menu.addItem( 3, "Save Chaser as..." );
		menu.addSeparator();

		menu.addItem( 4, "Export Pixelmap" );

		menu.addSeparator();
		menu.addItem( 5, "v" + String( ProjectInfo::versionString ), false, false );

		//		//if there is no active assfile, stop the timer
		//		bool isAvailable = FileHelper::isFileValid( sliceManager->getAssFile(), false );
		//		if ( !isAvailable )
		//			autoUpdate->stop();
	}

	else if ( menuIndex == 1 )
	{
		menu.addItem( 1, "Copy Step " + KeyPress( 'c', ModifierKeys::commandModifier, NULL ).getTextDescriptionWithIcons() );
		menu.addItem( 2, "Paste Step " + KeyPress( 'v', ModifierKeys::commandModifier, NULL ).getTextDescriptionWithIcons(), !stepToCopy.isEmpty() );
		menu.addItem( 3, "Clear Step" );
		menu.addItem( 4, "Invert Step" );
	}

	return menu;
}
Beispiel #7
0
bool MainContentComponent::keyPressed( const juce::KeyPress &key, juce::Component * )
{

	if ( key == KeyPress::leftKey )
	{
		sequencer->previousStep();
	}
	else if ( key == KeyPress::rightKey )
	{
		sequencer->nextStep();
	}
	else if ( key == KeyPress( 'c', ModifierKeys::commandModifier, NULL ) )
	{
		copyStep();
	}
	else if ( key == KeyPress( 'v', ModifierKeys::commandModifier, NULL ) )
	{
		pasteStep();
	}
	//secret shortcut to force opening a particular assfile
	else if ( key == KeyPress( 'o', ModifierKeys::commandModifier + ModifierKeys::shiftModifier, NULL ) )
	{
		loadAssFile();
	}

	return true;
}
void CtrlrLuaMethodEditor::addNewMethod(ValueTree parentGroup)
{
	AlertWindow wnd(METHOD_NEW, String::empty, AlertWindow::InfoIcon, this);
	wnd.addTextEditor ("methodName", "myNewMethod", "Method name", false);
	wnd.addComboBox ("templateList", getMethodManager().getTemplateList(), "Initialize from template");

	wnd.addButton ("OK", 1, KeyPress(KeyPress::returnKey));
	wnd.addButton ("Cancel", 0, KeyPress(KeyPress::escapeKey));
	if (wnd.runModalLoop())
	{
		const String methodName = wnd.getTextEditorContents("methodName");

		if (getMethodManager().isValidMethodName(methodName))
		{
			const String initialCode = getMethodManager().getDefaultMethodCode(methodName, wnd.getComboBoxComponent("templateList")->getText());

			getMethodManager().addMethod (parentGroup, wnd.getTextEditorContents("methodName"), initialCode, String::empty);
		}
		else
		{
			WARN("Invalid method name, please correct");
		}
	}

	updateRootItem();

	saveSettings(); // save settings
}
    void createNewFile (Project::Item parent)
    {
        for (;;)
        {
            AlertWindow aw (TRANS ("Create new Component class"),
                            TRANS ("Please enter the name for the new class"),
                            AlertWindow::NoIcon, nullptr);

            aw.addTextEditor (getClassNameFieldName(), String::empty, String::empty, false);
            aw.addButton (TRANS ("Create Files"),  1, KeyPress (KeyPress::returnKey));
            aw.addButton (TRANS ("Cancel"),        0, KeyPress (KeyPress::escapeKey));

            if (aw.runModalLoop() == 0)
                break;

            const String className (aw.getTextEditorContents (getClassNameFieldName()).trim());

            if (className == CodeHelpers::makeValidIdentifier (className, false, true, false))
            {
                const File newFile (askUserToChooseNewFile (className + ".h", "*.h;*.cpp", parent));

                if (newFile != File::nonexistent)
                    createFiles (parent, className, newFile);

                break;
            }
        }
    }
Beispiel #10
0
//-------------------------------------------------------------
//- Main
//- Main game loop
//-------------------------------------------------------------
void Main()
{
	static float fRot = 0.0f;
	static float fAnimSpeed = 1.0f;

	//Input
	//Pressing 'b' toggles the display of bones on and off
	if(KeyPressOnce('B'))
		g_ms3d.SwapBoneDraw();
	//Pressing 'w' toggles the display of the meshes
	if(KeyPressOnce('M'))
		g_ms3d.SwapMeshDraw();	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
	//Pressing left and right arrows rotate the model on the y axis
	if(KeyPress(VK_RIGHT))
		fRot += 0.3f;
	if(KeyPress(VK_LEFT))
		fRot -= 0.3f;
	//Pressing the up and down arrows change the animation speed of the model
	if(KeyPressOnce(VK_UP))
		if(fAnimSpeed < 4.9f)
			fAnimSpeed += 0.1f;
	if(KeyPressOnce(VK_DOWN))
		if(fAnimSpeed > 0.1f)
			fAnimSpeed -= 0.1f;
	//Take Screenshot
	if(KeyPressOnce('P'))
		CImage::ScreenShot();

	//Draw controls and information on the screen
	glColor3f(1.0f, 1.0f, 1.0f);
	glDisable(GL_LIGHTING);

	//Controls
	APP->Print(0.75f, 0.9f, "FPS: %4.2f", APP->GetFPS()); 
	APP->Print(-0.95f, 0.6f, "Controls");
	APP->Print(-0.95f, 0.5f, "B - Toggle the display of bones");
	APP->Print(-0.95f, 0.4f, "M - Toggle the display of the mesh");
	APP->Print(-0.95f, 0.3f, "Right/Left Arrows - Rotate model on Y axis");
	APP->Print(-0.95f, 0.2f, "Up/Down Arrows - Change animation speed");
	APP->Print(-0.95f, 0.1f, "P - Take Screenshot");
	
	//Info
	APP->Print(0.5f, 0.6f, "Animation Speed: %1.1f", fAnimSpeed);
	APP->Print(0.5f, 0.5f, "Bones: %s", (g_ms3d.AreBonesEnabled() ? "Enabled" : "Disabled"));
	APP->Print(0.5f, 0.4f, "Mesh: %s", (g_ms3d.AreMeshesEnabled() ? "Enabled" : "Disabled"));

	//On to the real GL stuff
	glLoadIdentity();

	glTranslatef(6.0f, -30.0f, -85.0f);
	glRotatef(fRot, 0.0f, 1.0f, 0.0f);
	glEnable(GL_LIGHTING);						

	g_ms3d.Animate(fAnimSpeed, 0, 2, true);
}	
Beispiel #11
0
void ProjucerApplication::getCommandInfo (CommandID commandID, ApplicationCommandInfo& result)
{
    switch (commandID)
    {
    case CommandIDs::newProject:
        result.setInfo ("New Project...", "Creates a new Jucer project", CommandCategories::general, 0);
        result.defaultKeypresses.add (KeyPress ('n', ModifierKeys::commandModifier, 0));
        break;

    case CommandIDs::open:
        result.setInfo ("Open...", "Opens a Jucer project", CommandCategories::general, 0);
        result.defaultKeypresses.add (KeyPress ('o', ModifierKeys::commandModifier, 0));
        break;

    case CommandIDs::showGlobalPreferences:
        result.setInfo ("Preferences...", "Shows the preferences window.", CommandCategories::general, 0);
        result.defaultKeypresses.add (KeyPress (',', ModifierKeys::commandModifier, 0));
        break;

    case CommandIDs::closeAllDocuments:
        result.setInfo ("Close All Documents", "Closes all open documents", CommandCategories::general, 0);
        result.setActive (openDocumentManager.getNumOpenDocuments() > 0);
        break;

    case CommandIDs::saveAll:
        result.setInfo ("Save All", "Saves all open documents", CommandCategories::general, 0);
        result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::altModifier, 0));
        break;

    case CommandIDs::showUTF8Tool:
        result.setInfo ("UTF-8 String-Literal Helper", "Shows the UTF-8 string literal utility", CommandCategories::general, 0);
        break;

    case CommandIDs::showSVGPathTool:
        result.setInfo ("SVG Path Helper", "Shows the SVG->Path data conversion utility", CommandCategories::general, 0);
        break;

    case CommandIDs::loginLogout:
        result.setInfo (ProjucerLicenses::getInstance()->isLoggedIn()
                           ? String ("Sign out ") + ProjucerLicenses::getInstance()->getLoginName()
                           : String ("Sign in..."),
                        "Log out of your JUCE account", CommandCategories::general, 0);
        result.setActive (ProjucerLicenses::getInstance()->isDLLPresent());
        break;

    default:
        JUCEApplication::getCommandInfo (commandID, result);
        break;
    }
}
void CtrlrLuaMethodEditor::renameGroup(ValueTree parentGroup)
{
	AlertWindow w ("Rename group", "", AlertWindow::QuestionIcon, this);
	w.addTextEditor("name", parentGroup.getProperty (Ids::name).toString());
	w.addButton ("OK", 1, KeyPress(KeyPress::returnKey));
	w.addButton ("Cancel", 0, KeyPress(KeyPress::escapeKey));

	if (w.runModalLoop())
	{
		parentGroup.setProperty (Ids::name, w.getTextEditorContents("name"), nullptr);
		updateRootItem();
	}

	saveSettings(); // save settings
}
Beispiel #13
0
void CApplication::KeyEvent(int c, int e)
{
	if (e == GLFW_PRESS)
		KeyPress(MapKey(c));
	else
		KeyRelease(MapKey(c));
}
Beispiel #14
0
int Plug_MenuEvent(int *args)
{
	int i;
	drawscalex = vid.width/640.0f;
	drawscaley = vid.height/480.0f;

	args[2]=(int)(args[2]/drawscalex);
	args[3]=(int)(args[3]/drawscaley);

	switch(args[0])
	{
	case 0:	//draw

		Draw_Colour4f(1,1,1,1);

		Draw_Image(((640 - (480-16))/2)*drawscalex, 16*drawscaley, (480-16)*drawscalex, (480-16)*drawscaley, 0, 0, 1, 1, con_chars);

		for (i = 0; namebuffer[i]; i++)
			DrawChar(namebuffer[i], i*16, 0);
		DrawChar(10 + (((currenttime/250)&1)==1), insertpos*16, 0);

		break;
	case 1:	//keydown
		KeyPress(args[1], args[2], args[3]);
		break;
	case 2:	//keyup
		break;
	case 3:	//menu closed (this is called even if we change it).
		break;
	case 4:	//mousemove
		break;
	}

	return 0;
}
//==============================================================================
MidiKeyboardComponent::MidiKeyboardComponent (MidiKeyboardState& s, Orientation o)
    : state (s), orientation (o)
{
    scrollDown.reset (new UpDownButton (*this, -1));
    scrollUp  .reset (new UpDownButton (*this, 1));

    addChildComponent (scrollDown.get());
    addChildComponent (scrollUp.get());

    // initialise with a default set of qwerty key-mappings..
    int note = 0;

    for (char c : "awsedftgyhujkolp;")
        setKeyPressForNote (KeyPress (c, 0, 0), note++);

    mouseOverNotes.insertMultiple (0, -1, 32);
    mouseDownNotes.insertMultiple (0, -1, 32);

    colourChanged();
    setWantsKeyboardFocus (true);

    state.addListener (this);

    startTimerHz (20);
}
//==============================================================================
MidiKeyboardComponent::MidiKeyboardComponent (MidiKeyboardState& state_,
                                              const Orientation orientation_)
    : state (state_),
      xOffset (0),
      blackNoteLength (1),
      keyWidth (16.0f),
      orientation (orientation_),
      midiChannel (1),
      midiInChannelMask (0xffff),
      velocity (1.0f),
      noteUnderMouse (-1),
      mouseDownNote (-1),
      rangeStart (0),
      rangeEnd (127),
      firstKey (12 * 4),
      canScroll (true),
      mouseDragging (false),
      useMousePositionForVelocity (true),
      keyMappingOctave (6),
      octaveNumForMiddleC (3)
{
    addChildComponent (scrollDown = new MidiKeyboardUpDownButton (*this, -1));
    addChildComponent (scrollUp   = new MidiKeyboardUpDownButton (*this, 1));

    // initialise with a default set of querty key-mappings..
    const char* const keymap = "awsedftgyhujkolp;";

    for (int i = String (keymap).length(); --i >= 0;)
        setKeyPressForNote (KeyPress (keymap[i], 0, 0), i);

    setOpaque (true);
    setWantsKeyboardFocus (true);

    state.addListener (this);
}
//==============================================================================
bool CodeEditorComponent::keyPressed (const KeyPress& key)
{
    if (! TextEditorKeyMapper<CodeEditorComponent>::invokeKeyFunction (*this, key))
    {
        if (key == KeyPress::tabKey || key.getTextCharacter() == '\t')      handleTabKey();
        else if (key == KeyPress::returnKey)                                handleReturnKey();
        else if (key == KeyPress::escapeKey)                                handleEscapeKey();
        else if (key == KeyPress ('[', ModifierKeys::commandModifier, 0))   unindentSelection();
        else if (key == KeyPress (']', ModifierKeys::commandModifier, 0))   indentSelection();
        else if (key.getTextCharacter() >= ' ')                             insertTextAtCaret (String::charToString (key.getTextCharacter()));
        else                                                                return false;
    }

    pimpl->handleUpdateNowIfNeeded();
    return true;
}
Beispiel #18
0
int main( int argc, char **argv )
{
    char key;

#ifndef __WATCOMC__
    _argc = argc;
    _argv = argv;
#endif

    Initialize();
    OpeningStatement();
    for( ;; ) {
        Output( TRP_MSG_press_q );
        Output( "\r\n" );
        for( ;; ) {
            if( RemoteConnect() ) break;
            NothingToDo();
            if( KeyPress() ) {
                key = KeyGet();
                if( key == 'q' || key == 'Q' ) {
                    KillTrap();
                    RemoteUnLink();
                    SayGNiteGracey( 0 );
                }
            }
        }
        Output( TRP_MSG_session_started );
        Output( "\r\n\r\n" );
        Session();
#ifndef NETWARE
        /* flush keyboard input */
        while( KeyPress() )
            KeyGet();
#endif
        Output( "\r\n\r\n" );
        Output( TRP_MSG_session_ended );
        Output( "\r\n\r\n" );
        RemoteDisco();
        if( OneShot ) {
            KillTrap();
            RemoteUnLink();
            SayGNiteGracey( 0 );
        }
    }
    return( 0 );
}
Beispiel #19
0
bool ComponentPeer::handleKeyPress (const int keyCode, const juce_wchar textCharacter)
{
    ModifierKeys::updateCurrentModifiers();

    return handleKeyPress (KeyPress (keyCode,
                                     ModifierKeys::getCurrentModifiers().withoutMouseButtons(),
                                     textCharacter));
}
Beispiel #20
0
const int customInfoDialog (const String &title, Component *customComponent)
{
	AlertWindow wnd(title, String::empty, AlertWindow::InfoIcon);
	customComponent->setSize (400,400);
	wnd.addCustomComponent (customComponent);
	wnd.addButton ("OK", 1, KeyPress (KeyPress::returnKey));
	return (wnd.runModalLoop());
}
Beispiel #21
0
void MainHostWindow::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
    const String category ("General");

    switch (commandID)
    {
    case CommandIDs::open:
        result.setInfo ("Open...",
                        "Opens a filter graph file",
                        category, 0);
        result.defaultKeypresses.add (KeyPress ('o', ModifierKeys::commandModifier, 0));
        break;

    case CommandIDs::save:
        result.setInfo ("Save",
                        "Saves the current graph to a file",
                        category, 0);
        result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
        break;

    case CommandIDs::saveAs:
        result.setInfo ("Save As...",
                        "Saves a copy of the current graph to a file",
                        category, 0);
        result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::shiftModifier | ModifierKeys::commandModifier, 0));
        break;

    case CommandIDs::showPluginListEditor:
        result.setInfo ("Edit the list of available plug-Ins...", String::empty, category, 0);
        result.addDefaultKeypress ('p', ModifierKeys::commandModifier);
        break;

    case CommandIDs::showAudioSettings:
        result.setInfo ("Change the audio device settings", String::empty, category, 0);
        result.addDefaultKeypress ('a', ModifierKeys::commandModifier);
        break;

    case CommandIDs::aboutBox:
        result.setInfo ("About...", String::empty, category, 0);
        break;

    default:
        break;
    }
}
Beispiel #22
0
void TextBuffer::cut()
{
  if (getHighlightedRegionLength()>0)
    {
      copy();
      keyPressed(KeyPress(KeyPress::deleteKey));
    }
  setFlag(EditFlags::NeedsSave);
}
void DocumentWindow::lookAndFeelChanged()
{
    int i;
    for (i = numElementsInArray (titleBarButtons); --i >= 0;)
        titleBarButtons[i] = 0;

    if (! isUsingNativeTitleBar())
    {
        titleBarButtons[0] = ((requiredButtons & minimiseButton) != 0)
                                ? getLookAndFeel().createDocumentWindowButton (minimiseButton) : 0;

        titleBarButtons[1] = ((requiredButtons & maximiseButton) != 0)
                                ? getLookAndFeel().createDocumentWindowButton (maximiseButton) : 0;

        titleBarButtons[2] = ((requiredButtons & closeButton) != 0)
                                ? getLookAndFeel().createDocumentWindowButton (closeButton) : 0;

        for (i = 0; i < 3; ++i)
        {
            if (titleBarButtons[i] != 0)
            {
                buttonListener.owner = this;
                titleBarButtons[i]->addButtonListener (&buttonListener);
                titleBarButtons[i]->setWantsKeyboardFocus (false);

                // (call the Component method directly to avoid the assertion in ResizableWindow)
                Component::addAndMakeVisible (titleBarButtons[i]);
            }
        }

        if (getCloseButton() != 0)
        {
#if JUCE_MAC
            getCloseButton()->addShortcut (KeyPress (T('w'), ModifierKeys::commandModifier, 0));
#else
            getCloseButton()->addShortcut (KeyPress (KeyPress::F4Key, ModifierKeys::altModifier, 0));
#endif
        }
    }

    activeWindowStatusChanged();

    ResizableWindow::lookAndFeelChanged();
}
//*************************************************************************************************************
LRESULT WINAPI WndProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
	switch( msg )
	{
	case WM_CLOSE:
		ShowWindow(hWnd, SW_HIDE);
		DestroyWindow(hWnd);
		break;

	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;

	case WM_KEYUP:
		switch(wParam)
		{
		case VK_ESCAPE:
			SendMessage(hWnd, WM_CLOSE, 0, 0);
			break;

		default:
			KeyPress(wParam);
			break;
		}
		break;

	case WM_MOUSEMOVE: {
		short x = (short)(lParam & 0xffff);
		short y = (short)((lParam >> 16) & 0xffff);

		mousedx += x - mousex;
		mousedy += y - mousey;

		mousex = x;
		mousey = y;
		} break;

	case WM_LBUTTONDOWN:
		mousedown = 1;
		break;

	case WM_RBUTTONDOWN:
		mousedown = 2;
		break;

	case WM_LBUTTONUP:
	case WM_RBUTTONUP:
		mousedown = 0;
		break;

	default:
		break;
	}

	return DefWindowProc(hWnd, msg, wParam, lParam);
}
Beispiel #25
0
void MainWindow::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
    if (commandID >= CommandIDs::newDocumentBase
         && commandID < CommandIDs::newDocumentBase + ObjectTypes::numDocumentTypes)
    {
        const int index = commandID - CommandIDs::newDocumentBase;

        result.setInfo ("New " + String (ObjectTypes::documentTypeNames [index]),
                        "Creates a new " + String (ObjectTypes::documentTypeNames[index]),
                        CommandCategories::general, 0);

        return;
    }

    const int cmd = ModifierKeys::commandModifier;

    switch (commandID)
    {
    case CommandIDs::open:
        result.setInfo ("Open...",
                        "Opens a Jucer .cpp component file for editing.",
                        CommandCategories::general, 0);
        result.defaultKeypresses.add (KeyPress ('o', cmd, 0));
        break;

    case CommandIDs::showPrefs:
        result.setInfo ("Preferences...",
                        "Shows the preferences panel.",
                        CommandCategories::general, 0);
        result.defaultKeypresses.add (KeyPress (',', cmd, 0));
        break;

    case CommandIDs::useTabbedWindows:
        result.setInfo ("Use tabs to show windows",
                        "Flips between a tabbed component and separate windows",
                        CommandCategories::general, 0);
        result.setTicked (multiDocHolder->getLayoutMode() == MultiDocumentPanel::MaximisedWindowsWithTabs);
        break;

    default:
        break;
    }
}
Beispiel #26
0
PizKeyboardComponent::PizKeyboardComponent(MidiKeyboardState &state, const Orientation orientation)
    : MidiKeyboardComponent(state,orientation),
	drawQwerty(false),
	drawNoteNumber(false)
{
    s = &state;
    for (int i = String (keymap).length(); --i >= 0;)
        setKeyPressForNote (KeyPress (keymap[i], 0, 0), i);
    setKeyPressBaseOctave(4);
}
Beispiel #27
0
//==================================================================================================================
bool ComponentOverlay::keyPressed (const KeyPress& key, Component* originatingComponent)
{
    bool multipleSelection = false;
    const int gridSize =  2;

    for (ComponentOverlay* child : layoutEditor->getLassoSelection())
    {
        if (key == KeyPress::leftKey || key == KeyPress::rightKey)
            child->setTopLeftPosition (child->getPosition().getX() + (key == KeyPress::leftKey ? -gridSize : gridSize), child->getPosition().getY());

        else if (key == KeyPress::upKey || key == KeyPress::downKey)
            child->setTopLeftPosition (child->getPosition().getX(), child->getPosition().getY() + (key == KeyPress::upKey ? -gridSize : gridSize));

        else if (key == KeyPress (KeyPress::leftKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX() - gridSize * 4, child->getPosition().getY());

        else if (key == KeyPress (KeyPress::rightKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX() + gridSize * 4, child->getPosition().getY());

        else if (key == KeyPress (KeyPress::upKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX(), child->getPosition().getY() - gridSize * 4);

        else if (key == KeyPress (KeyPress::downKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX(), child->getPosition().getY() + gridSize * 4);


        child->applyToTarget();
        multipleSelection = true;
        layoutEditor->updateSelectedComponentBounds();
    }

    if (multipleSelection == false)
    {
        setTopLeftPosition (getPosition().getX() - gridSize, getPosition().getY());
        applyToTarget();
    }

    updateBoundsDataForTarget();
    layoutEditor->updateCodeEditor();

    return false;
}
BEGIN_JUCE_NAMESPACE

#include "juce_FileChooserDialogBox.h"
#include "../lookandfeel/juce_LookAndFeel.h"
#include "../../../text/juce_LocalisedStrings.h"
#include "../windows/juce_AlertWindow.h"


//==============================================================================
FileChooserDialogBox::FileChooserDialogBox (const String& name,
                                            const String& instructions,
                                            FileBrowserComponent& chooserComponent,
                                            const bool warnAboutOverwritingExistingFiles_,
                                            const Colour& backgroundColour)
    : ResizableWindow (name, backgroundColour, true),
      warnAboutOverwritingExistingFiles (warnAboutOverwritingExistingFiles_)
{
    content = new ContentComponent();
    content->setName (name);
    content->instructions = instructions;
    content->chooserComponent = &chooserComponent;

    content->addAndMakeVisible (&chooserComponent);

    content->okButton = new TextButton (chooserComponent.getActionVerb());
    content->addAndMakeVisible (content->okButton);
    content->okButton->addButtonListener (this);
    content->okButton->setEnabled (chooserComponent.currentFileIsValid());
    content->okButton->addShortcut (KeyPress (KeyPress::returnKey, 0, 0));

    content->cancelButton = new TextButton (TRANS("Cancel"));
    content->addAndMakeVisible (content->cancelButton);
    content->cancelButton->addButtonListener (this);
    content->cancelButton->addShortcut (KeyPress (KeyPress::escapeKey, 0, 0));

    setContentComponent (content);

    setResizable (true, true);
    setResizeLimits (300, 300, 1200, 1000);

    content->chooserComponent->addListener (this);
}
Beispiel #29
0
    Scanner (CabbagePluginListComponent& plc, AudioPluginFormat& format, const StringArray& filesOrIdentifiers,
             PropertiesFile* properties, bool allowPluginsWhichRequireAsynchronousInstantiation, int threads,
             const String& title, const String& text)
        : owner (plc), formatToScan (format), filesOrIdentifiersToScan (filesOrIdentifiers), propertiesToUse (properties),
          pathChooserWindow (TRANS("Select folders to scan..."), String(), AlertWindow::NoIcon),
          progressWindow (title, text, AlertWindow::NoIcon),
          progress (0.0), numThreads (threads), allowAsync (allowPluginsWhichRequireAsynchronousInstantiation),
          finished (false)
    {
		pathChooserWindow.setLookAndFeel(&owner.getLookAndFeel());
		progressWindow.setLookAndFeel(&owner.getLookAndFeel());
        FileSearchPath path (formatToScan.getDefaultLocationsToSearch());

        // You need to use at least one thread when scanning plug-ins asynchronously
        jassert (! allowAsync || (numThreads > 0));

        // If the filesOrIdentifiersToScan argumnent isn't empty, we should only scan these
        // If the path is empty, then paths aren't used for this format.
        if (filesOrIdentifiersToScan.isEmpty() && path.getNumPaths() > 0)
        {
           #if ! JUCE_IOS
            if (propertiesToUse != nullptr)
                path = getLastSearchPath (*propertiesToUse, formatToScan);
           #endif

            pathList.setSize (500, 300);
            pathList.setPath (path);

            pathChooserWindow.addCustomComponent (&pathList);
            pathChooserWindow.addButton (TRANS("Scan"),   1, KeyPress (KeyPress::returnKey));
            pathChooserWindow.addButton (TRANS("Cancel"), 0, KeyPress (KeyPress::escapeKey));

            pathChooserWindow.enterModalState (true,
                                               ModalCallbackFunction::forComponent (startScanCallback,
                                                                                    &pathChooserWindow, this),
                                               false);
        }
        else
        {
            startScan();
        }
    }
void JUCEApplication::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
{
    if (commandID == StandardApplicationCommandIDs::quit)
    {
        result.setInfo (TRANS("Quit"),
                        TRANS("Quits the application"),
                        "Application", 0);

        result.defaultKeypresses.add (KeyPress ('q', ModifierKeys::commandModifier, 0));
    }
}