int luaopen_mouse(lua_State* L) { static const struct Function cursor[] = { {"set_position", l_mouse_cursor_set_position}, {"move", l_mouse_cursor_move}, {NULL, NULL} }; static const struct Function button[] = { {"click", l_mouse_button_click}, {NULL, NULL} }; static const struct Lib lib[] = { {"cursor", cursor}, {"button", button}, {NULL, NULL} }; new_lib(L, "Mouse", lib, NULL); static const struct Constant MS[] = { {"LEFT", MS_LEFT}, {"MIDDLE", MS_MIDDLE}, {"RIGHT", MS_RIGHT}, {"WHEELUP", MS_WHEELUP}, {"WHEELDOWN", MS_WHEELDOWN}, {NULL, 0} }; new_constants(L, "MS", MS); return 0; }
void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event ) { m_lastDrawItem = NULL; wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath, m_mruPath, SchematicLibraryFileWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) return; wxFileName fn = dlg.GetPath(); m_mruPath = fn.GetPath(); std::auto_ptr<PART_LIB> lib; try { std::auto_ptr<PART_LIB> new_lib( PART_LIB::LoadLibrary( fn.GetFullPath() ) ); lib = new_lib; } catch( const IO_ERROR& ioe ) { wxString msg = wxString::Format( _( "Unable to import library '%s'. Error:\n" "%s" ), GetChars( fn.GetFullPath() ) ); DisplayError( this, msg ); return; } LIB_ALIAS* entry = lib->GetFirstEntry(); if( !entry ) { wxString msg = wxString::Format( _( "Part library file '%s' is empty." ), GetChars( fn.GetFullPath() ) ); DisplayError( this, msg ); return; } if( LoadOneLibraryPartAux( entry, lib.get() ) ) { fn = dlg.GetPath(); m_lastLibImportPath = fn.GetPath(); DisplayLibInfos(); GetScreen()->ClearUndoRedoList(); m_canvas->Refresh(); } }
int luaopen_screen(lua_State* L) { static struct Function functions[] = { {"width", l_screen_width}, {"height", l_screen_height}, {NULL, NULL} }; new_lib(L, "Screen", NULL, functions); return 0; }
int luaopen_guitar(lua_State* L) { static const struct Function button[] = { {"pressed", l_guitar_button_pressed}, {NULL, NULL} }; static const struct Function joystick[] = { {"polar", l_guitar_joystick_polar}, {"cartesian", l_guitar_joystick_cartesian}, {NULL, NULL} }; static const struct Function shoulder[] = { {"whammy_bar", l_guitar_shoulder_whammy_bar}, {NULL, NULL} }; static const struct Lib lib[] = { {"button", button}, {"joystick", joystick}, {"shoulder", shoulder}, {NULL, NULL} }; new_lib(L, "Guitar", lib, NULL); static const struct Constant GH[] = { {"STRUMUP", GH_STRUMUP}, {"YELLOW", GH_YELLOW}, {"GREEN", GH_GREEN}, {"BLUE", GH_BLUE}, {"RED", GH_RED}, {"ORANGE", GH_ORANGE}, {"PLUS", GH_PLUS}, {"MINUS", GH_MINUS}, {"STRUMDOWN", GH_STRUMDOWN}, {NULL, 0} }; new_constants(L, "GH", GH); return 0; }