diff --git a/ChangeLog b/ChangeLog index 22730a2c1..5987b1b67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,92 @@ +2008-11-21 Tobias Doerffel + + * plugins/flp_import/flp_import.h: + * plugins/flp_import/flp_import.cpp: + completely rewrote FLP import filter since it didn't work at all + anymore - it now doesn't create or change any things in LMMS while + importing and instead builds up a complete data structure first + which represents the FL Studio project and then creates an LMMS + project based upon this data structure + - now supports projects from FL Studio 3 to 8 + - more verbose debug output + - import volume, panning, pitch and FX channel for instrument tracks + - import amplification, loop-mode and reverse-mode settings for + AudioFileProcessor + - import FX mixer settings and effects + - import automation data + - import channel- and pattern names + - import volume and panning settings of individual notes + - add notes of instrument layer master to each layer children for at + least having a complete sound - need to replace with real layering + support later + - map more instruments to various LMMS instruments + - fixed calculations of length and position of notes + - fixed importing steps/dots + - fixed scaling factor of various controls (arpeggio time, + envelope sustain and amount, filter cut/res, TripleOsc volumes etc.) + - if three user defined samples were found for TripleOscillator set + first oscillator to oscillator::SawWave + + * plugins/flp_import/unrtf.cpp: + * plugins/flp_import/CMakeLists.txt: + * plugins/flp_import/unrtf/error.h: + * plugins/flp_import/unrtf/output.c: + * plugins/flp_import/unrtf/html.c: + * plugins/flp_import/unrtf/output.h: + * plugins/flp_import/unrtf/malloc.c: + * plugins/flp_import/unrtf/html.h: + * plugins/flp_import/unrtf/attr.c: + * plugins/flp_import/unrtf/parse.c: + * plugins/flp_import/unrtf/word.c: + * plugins/flp_import/unrtf/malloc.h: + * plugins/flp_import/unrtf/util.c: + * plugins/flp_import/unrtf/attr.h: + * plugins/flp_import/unrtf/parse.h: + * plugins/flp_import/unrtf/convert.c: + * plugins/flp_import/unrtf/word.h: + * plugins/flp_import/unrtf/util.h: + * plugins/flp_import/unrtf/hash.c: + * plugins/flp_import/unrtf/convert.h: + * plugins/flp_import/unrtf/defs.h: + * plugins/flp_import/unrtf/hash.h: + * plugins/flp_import/unrtf/main.h: + * plugins/flp_import/unrtf/error.c: + updated to latest version of unrtf and improved string operations + + * src/core/main.cpp: + added support for importing file from commandline + + * include/effect_chain.h: + added method for enabling/disabling FX chain + + * include/file_browser.h: + * src/gui/file_browser.cpp: + enhanced support for importing various file types directly from browser + + * include/pattern.h: + * src/tracks/pattern.cpp: + added method for toggling steps + + * include/fx_mixer.h: + added method for accessing FX channels + + * plugins/midi_import/midi_import.cpp: + check for tempoAutomationPattern being NULL for not crashing when + importing to BB-Editor + + * include/instrument_track.h: + return pointers instead of references to various internal models + + * include/basic_filters.h: + * include/bb_track_container.h: + * include/instrument_track.h: + * include/pattern.h: + * include/track_container.h: + * src/core/instrument_functions.cpp: + * src/tracks/pattern.cpp: + * src/gui/track_container_view.cpp: + coding style fixes + 2008-11-13 Andrew Kelley * src/gui/piano_roll.cpp: diff --git a/include/basic_filters.h b/include/basic_filters.h index f2da1a41f..2c544b1f6 100644 --- a/include/basic_filters.h +++ b/include/basic_filters.h @@ -45,7 +45,7 @@ template class basicFilters { public: - enum filterTypes + enum FilterTypes { LowPass, HiPass, @@ -54,7 +54,7 @@ public: Notch, AllPass, Moog, - NumOfFilters + NumFilters } ; static inline float minFreq( void ) @@ -69,14 +69,14 @@ public: inline void setFilterType( const int _idx ) { - m_doubleFilter = _idx >= NumOfFilters; + m_doubleFilter = _idx >= NumFilters; if( !m_doubleFilter ) { - m_type = static_cast( _idx ); + m_type = static_cast( _idx ); return; } - m_type = static_cast( LowPass + _idx - - NumOfFilters ); + m_type = static_cast( LowPass + _idx - + NumFilters ); if( m_subFilter == NULL ) { m_subFilter = new basicFilters( @@ -289,7 +289,7 @@ private: // in/out history for moog-filter frame m_y1, m_y2, m_y3, m_y4, m_oldx, m_oldy1, m_oldy2, m_oldy3; - filterTypes m_type; + FilterTypes m_type; bool m_doubleFilter; float m_sampleRate; diff --git a/include/bb_track_container.h b/include/bb_track_container.h index 7685d8742..597aea67a 100644 --- a/include/bb_track_container.h +++ b/include/bb_track_container.h @@ -52,7 +52,7 @@ public: tact lengthOfBB( int _bb ); inline tact lengthOfCurrentBB( void ) { - return( lengthOfBB( currentBB() ) ); + return lengthOfBB( currentBB() ); } int numOfBBs( void ) const; void removeBB( int _bb ); diff --git a/include/effect_chain.h b/include/effect_chain.h index 8849648cd..18fa3fd2d 100644 --- a/include/effect_chain.h +++ b/include/effect_chain.h @@ -46,7 +46,7 @@ public: inline virtual QString nodeName( void ) const { - return( "fxchain" ); + return "fxchain"; } void appendEffect( effect * _effect ); @@ -59,6 +59,11 @@ public: void clear( void ); + void setEnabled( bool _on ) + { + m_enabledModel.setValue( _on ); + } + private: typedef QVector effectList; diff --git a/include/file_browser.h b/include/file_browser.h index a66ae7651..efff40905 100644 --- a/include/file_browser.h +++ b/include/file_browser.h @@ -187,7 +187,8 @@ public: NotSupported, LoadAsProject, LoadAsPreset, - LoadByPlugin + LoadByPlugin, + ImportAsProject } ; diff --git a/include/fx_mixer.h b/include/fx_mixer.h index 70f5d98ee..2feaf5a84 100644 --- a/include/fx_mixer.h +++ b/include/fx_mixer.h @@ -75,7 +75,16 @@ public: virtual QString nodeName( void ) const { - return( "fxmixer" ); + return "fxmixer"; + } + + fxChannel * getEffectChannel( int _ch ) + { + if( _ch >= 0 && _ch <= NumFxChannels ) + { + return m_fxChannels[_ch]; + } + return NULL; } diff --git a/include/instrument_track.h b/include/instrument_track.h index 6b4ddd114..d8db9cc79 100644 --- a/include/instrument_track.h +++ b/include/instrument_track.h @@ -88,12 +88,12 @@ public: QString instrumentName( void ) const; inline const instrument * getInstrument( void ) const { - return( m_instrument ); + return m_instrument; } inline instrument * getInstrument( void ) { - return( m_instrument ); + return m_instrument; } void deleteNotePluginData( notePlayHandle * _n ); @@ -108,7 +108,7 @@ public: // translate pitch to midi-pitch [0,16383] inline int midiPitch( void ) const { - return( (int)( ( m_pitchModel.value()+100 ) * 81.92 ) ); + return (int)( ( m_pitchModel.value()+100 ) * 81.92 ); } // play everything in given frame-range - creates note-play-handles @@ -135,47 +135,53 @@ public: inline audioPort * getAudioPort( void ) { - return( &m_audioPort ); + return &m_audioPort; } inline midiPort * getMidiPort( void ) { - return( &m_midiPort ); + return &m_midiPort; } intModel * baseNoteModel( void ) { - return( &m_baseNoteModel ); + return &m_baseNoteModel; } piano * getPiano( void ) { - return( &m_piano ); + return &m_piano; } bool arpeggiatorEnabled( void ) const { - return( m_arpeggiator.m_arpEnabledModel.value() ); + return m_arpeggiator.m_arpEnabledModel.value(); } // simple helper for removing midiport-XML-node when loading presets static void removeMidiPortNode( multimediaProject & _mmp ); - floatModel & pitchModel() + floatModel * pitchModel( void ) { - return m_pitchModel; + return &m_pitchModel; } - floatModel & volumeModel() + floatModel * volumeModel( void ) { - return m_volumeModel; + return &m_volumeModel; } - floatModel & panningModel() + floatModel * panningModel( void ) { - return m_panningModel; + return &m_panningModel; } + intModel * effectChannelModel( void ) + { + return &m_effectChannelModel; + } + + signals: void instrumentChanged( void ); void newNote( void ); @@ -186,7 +192,7 @@ signals: protected: virtual QString nodeName( void ) const { - return( "instrumenttrack" ); + return "instrumenttrack"; } // invalidates all note-play-handles linked to this instrument void invalidateAllMyNPH( void ); @@ -245,18 +251,18 @@ public: instrumentTrack * model( void ) { - return( castModel() ); + return castModel(); } const instrumentTrack * model( void ) const { - return( castModel() ); + return castModel(); } QMenu * midiMenu( void ) { - return( m_midiMenu ); + return m_midiMenu; } void freeInstrumentTrackWindow( void ); @@ -314,17 +320,17 @@ public: // parent for all internal tab-widgets tabWidget * tabWidgetParent( void ) { - return( m_tabWidget ); + return m_tabWidget; } instrumentTrack * model( void ) { - return( castModel() ); + return castModel(); } const instrumentTrack * model( void ) const { - return( castModel() ); + return castModel(); } void setInstrumentTrackView( instrumentTrackView * _tv ) diff --git a/include/pattern.h b/include/pattern.h index e7614b402..d256e90a4 100644 --- a/include/pattern.h +++ b/include/pattern.h @@ -68,24 +68,27 @@ public: virtual midiTime length( void ) const; midiTime beatPatternLength( void ) const; - note * addNote( const note & _new_note, const bool _quant_pos = TRUE ); + // note management + note * addNote( const note & _new_note, const bool _quant_pos = true ); void removeNote( const note * _note_to_del ); note * rearrangeNote( const note * _note_to_proc, - const bool _quant_pos = TRUE ); + const bool _quant_pos = true ); void rearrangeAllNotes( void ); void clearNotes( void ); inline const noteVector & notes( void ) { - return( m_notes ); + return m_notes; } + void setStep( int _step, bool _enabled ); + // pattern-type stuff inline PatternTypes type( void ) const { - return( m_patternType ); + return m_patternType; } void setType( PatternTypes _new_pattern_type ); void checkType( void ); @@ -94,17 +97,17 @@ public: // functions which are part of freezing-feature inline bool freezing( void ) const { - return( m_freezing ); + return m_freezing; } inline bool frozen( void ) const { - return( m_frozenPattern != NULL ); + return m_frozenPattern != NULL; } sampleBuffer * getFrozenPattern( void ) { - return( m_frozenPattern ); + return m_frozenPattern; } // settings-management @@ -112,12 +115,12 @@ public: virtual void loadSettings( const QDomElement & _this ); inline virtual QString nodeName( void ) const { - return( "pattern" ); + return "pattern"; } inline instrumentTrack * getInstrumentTrack( void ) { - return( m_instrumentTrack ); + return m_instrumentTrack; } bool empty( void ); @@ -197,7 +200,7 @@ protected: virtual void paintEvent( QPaintEvent * _pe ); virtual void resizeEvent( QResizeEvent * _re ) { - m_needsUpdate = TRUE; + m_needsUpdate = true; trackContentObjectView::resizeEvent( _re ); } virtual void wheelEvent( QWheelEvent * _we ); diff --git a/include/track_container.h b/include/track_container.h index 2e02635e9..6920d25df 100644 --- a/include/track_container.h +++ b/include/track_container.h @@ -54,7 +54,7 @@ public: virtual automationPattern * tempoAutomationPattern( void ) { - return( NULL ); + return NULL; } int countTracks( track::TrackTypes _tt = track::NumTrackTypes ) const; @@ -69,14 +69,14 @@ public: const trackList & tracks( void ) const { - return( m_tracks ); + return m_tracks; } bool isEmpty( void ) const; static const QString classNodeName( void ) { - return( "trackcontainer" ); + return "trackcontainer"; } @@ -107,12 +107,12 @@ public: virtual QString nodeName( void ) const { - return( "dummytrackcontainer" ); + return "dummytrackcontainer"; } instrumentTrack * dummyInstrumentTrack( void ) { - return( m_dummyInstrumentTrack ); + return m_dummyInstrumentTrack; } diff --git a/plugins/flp_import/CMakeLists.txt b/plugins/flp_import/CMakeLists.txt index 9b13c0b4a..702f49e31 100644 --- a/plugins/flp_import/CMakeLists.txt +++ b/plugins/flp_import/CMakeLists.txt @@ -2,4 +2,4 @@ INCLUDE(BuildPlugin) INCLUDE_DIRECTORIES(unrtf) -BUILD_PLUGIN(flpimport flp_import.cpp flp_import.h) +BUILD_PLUGIN(flpimport flp_import.cpp unrtf.cpp flp_import.h) diff --git a/plugins/flp_import/flp_import.cpp b/plugins/flp_import/flp_import.cpp index 10b3e15d2..674918c48 100644 --- a/plugins/flp_import/flp_import.cpp +++ b/plugins/flp_import/flp_import.cpp @@ -31,13 +31,16 @@ #include "flp_import.h" #include "note_play_handle.h" +#include "automation_pattern.h" #include "basic_filters.h" #include "bb_track.h" #include "bb_track_container.h" #include "combobox.h" #include "config_mgr.h" #include "debug.h" +#include "effect.h" #include "engine.h" +#include "fx_mixer.h" #include "group_box.h" #include "instrument.h" #include "instrument_track.h" @@ -80,7 +83,6 @@ plugin::descriptor PLUGIN_EXPORT flpimport_plugin_descriptor = } ; - // unrtf-stuff #include "defs.h" #include "main.h" @@ -90,20 +92,14 @@ plugin::descriptor PLUGIN_EXPORT flpimport_plugin_descriptor = #include "convert.h" #include "attr.h" - -OutputPersonality * op = NULL; -int lineno = 0; -#define inline_mode 0 -#define debug_mode 0 -#define nopict_mode 1 -#define verbose_mode 0 -#define simple_mode 0 - +extern OutputPersonality * op; +extern int lineno; extern QString outstring; } + static void dump_mem( const void * buffer, uint n_bytes ) { uchar * cp = (uchar *) buffer; @@ -115,6 +111,466 @@ static void dump_mem( const void * buffer, uint n_bytes ) } +enum FLP_Events +{ + // BYTE EVENTS + FLP_Byte = 0, + FLP_Enabled = 0, + FLP_NoteOn = 1, //+pos (byte) + FLP_Vol = 2, + FLP_Pan = 3, + FLP_MIDIChan = 4, + FLP_MIDINote = 5, + FLP_MIDIPatch = 6, + FLP_MIDIBank = 7, + FLP_LoopActive = 9, + FLP_ShowInfo = 10, + FLP_Shuffle = 11, + FLP_MainVol = 12, + FLP_Stretch = 13, // old byte version + FLP_Pitchable = 14, + FLP_Zipped = 15, + FLP_Delay_Flags = 16, + FLP_PatLength = 17, + FLP_BlockLength = 18, + FLP_UseLoopPoints = 19, + FLP_LoopType = 20, + FLP_ChanType = 21, + FLP_MixSliceNum = 22, + FLP_EffectChannelMuted = 27, + + // WORD EVENTS + FLP_Word = 64, + FLP_NewChan = FLP_Word, + FLP_NewPat = FLP_Word + 1, //+PatNum (word) + FLP_Tempo = FLP_Word + 2, + FLP_CurrentPatNum = FLP_Word + 3, + FLP_PatData = FLP_Word + 4, + FLP_FX = FLP_Word + 5, + FLP_Fade_Stereo = FLP_Word + 6, + FLP_CutOff = FLP_Word + 7, + FLP_DotVol = FLP_Word + 8, + FLP_DotPan = FLP_Word + 9, + FLP_PreAmp = FLP_Word + 10, + FLP_Decay = FLP_Word + 11, + FLP_Attack = FLP_Word + 12, + FLP_DotNote = FLP_Word + 13, + FLP_DotPitch = FLP_Word + 14, + FLP_DotMix = FLP_Word + 15, + FLP_MainPitch = FLP_Word + 16, + FLP_RandChan = FLP_Word + 17, + FLP_MixChan = FLP_Word + 18, + FLP_Resonance = FLP_Word + 19, + FLP_LoopBar = FLP_Word + 20, + FLP_StDel = FLP_Word + 21, + FLP_FX3 = FLP_Word + 22, + FLP_DotReso = FLP_Word + 23, + FLP_DotCutOff = FLP_Word + 24, + FLP_ShiftDelay = FLP_Word + 25, + FLP_LoopEndBar = FLP_Word + 26, + FLP_Dot = FLP_Word + 27, + FLP_DotShift = FLP_Word + 28, + FLP_LayerChans = FLP_Word + 30, + + // DWORD EVENTS + FLP_Int = 128, + FLP_Color = FLP_Int, + FLP_PlayListItem = FLP_Int + 1, //+Pos (word) +PatNum (word) + FLP_Echo = FLP_Int + 2, + FLP_FXSine = FLP_Int + 3, + FLP_CutCutBy = FLP_Int + 4, + FLP_WindowH = FLP_Int + 5, + FLP_MiddleNote = FLP_Int + 7, + FLP_Reserved = FLP_Int + 8, // may contain an invalid + // version info + FLP_MainResoCutOff = FLP_Int + 9, + FLP_DelayReso = FLP_Int + 10, + FLP_Reverb = FLP_Int + 11, + FLP_IntStretch = FLP_Int + 12, + FLP_SSNote = FLP_Int + 13, + FLP_FineTune = FLP_Int + 14, + + // TEXT EVENTS + FLP_Undef = 192, //+Size (var length) + FLP_Text = FLP_Undef, //+Size (var length)+Text + // (Null Term. String) + FLP_Text_ChanName = FLP_Text, // name for the current channel + FLP_Text_PatName = FLP_Text + 1, // name for the current pattern + FLP_Text_Title = FLP_Text + 2, // title of the loop + FLP_Text_Comment = FLP_Text + 3, // old comments in text format. + // Not used anymore + FLP_Text_SampleFileName = FLP_Text + 4, // filename for the sample in + // the current channel, stored + // as relative path + FLP_Text_URL = FLP_Text + 5, + FLP_Text_CommentRTF = FLP_Text + 6, // new comments in Rich Text + // format + FLP_Text_Version = FLP_Text + 7, + FLP_Text_PluginName = FLP_Text + 9, // plugin file name + // (without path) + + FLP_Text_EffectChanName = FLP_Text + 12, + FLP_Text_MIDICtrls = FLP_Text + 16, + FLP_Text_Delay = FLP_Text + 17, + FLP_Text_TS404Params = FLP_Text + 18, + FLP_Text_DelayLine = FLP_Text + 19, + FLP_Text_NewPlugin = FLP_Text + 20, + FLP_Text_PluginParams = FLP_Text + 21, + FLP_Text_ChanParams = FLP_Text + 23,// block of various channel + // params (can grow) + FLP_Text_EnvLfoParams = FLP_Text + 26, + FLP_Text_BasicChanParams= FLP_Text + 27, + FLP_Text_OldFilterParams= FLP_Text + 28, + FLP_Text_AutomationData = FLP_Text + 31, + FLP_Text_PatternNotes = FLP_Text + 32, + FLP_Text_ChanGroupName = FLP_Text + 39, + FLP_Text_PlayListItems = FLP_Text + 41, + + FLP_CmdCount + +} ; + + +struct FL_Automation +{ + FL_Automation() : + pos( 0 ), + value( 0 ), + channel( 0 ), + control( 0 ) + { + } + + enum Controls + { + ControlVolume = 0, + ControlPanning = 1, + ControlFilterCut = 2, + ControlFilterRes = 3, + ControlPitch = 4, + ControlFilterType = 5, + ControlFXChannel = 8, + + ControlVolPredelay = 4354, + ControlVolAttack, + ControlVolHold, + ControlVolDecay, + ControlVolSustain, + ControlVolRelease, + ControlVolLfoPredelay = ControlVolPredelay+7, + ControlVolLfoAttack, + ControlVolLfoAmount, + ControlVolLfoSpeed, + ControlVolAttackTension = ControlVolPredelay+12, + ControlVolDecayTension, + ControlVolReleaseTension, + ControlCutPredelay = 4610, + ControlCutAttack, + ControlCutHold, + ControlCutDecay, + ControlCutSustain, + ControlCutRelease, + ControlCutAmount, + ControlCutLfoPredelay = ControlCutPredelay+7, + ControlCutLfoAttack, + ControlCutLfoAmount, + ControlCutLfoSpeed, + ControlCutAttackTension = ControlCutPredelay+12, + ControlCutDecayTension, + ControlCutReleaseTension, + + ControlResPredelay = 4866, + ControlResAttack, + ControlResHold, + ControlResDecay, + ControlResSustain, + ControlResRelease, + ControlResAmount, + ControlResLfoPredelay = ControlResPredelay+7, + ControlResLfoAttack, + ControlResLfoAmount, + ControlResLfoSpeed, + ControlResAttackTension = ControlResPredelay+12, + ControlResDecayTension, + ControlResReleaseTension + } ; + + int pos; + int value; + int channel; + int control; + +} ; + + + +struct FL_Channel_Envelope +{ + instrumentSoundShaping::Targets target; + float predelay; + float attack; + float hold; + float decay; + float sustain; + float release; + float amount; +} ; + + +struct FL_Plugin +{ + enum PluginTypes + { + UnknownPlugin, + + InstrumentPlugin, + Sampler, + TS404, + Fruity_3x_Osc, + Layer, + BeepMap, + BuzzGeneratorAdapter, + FruitKick, + FruityDrumSynthLive, + FruityDX10, + FruityGranulizer, + FruitySlicer, + FruitySoundfontPlayer, + FruityVibrator, + MidiOut, + Plucked, + SimSynth, + Sytrus, + WASP, + + EffectPlugin, + Fruity7BandEq, + FruityBalance, + FruityBassBoost, + FruityBigClock, + FruityBloodOverdrive, + FruityCenter, + FruityChorus, + FruityCompressor, + FruityDbMeter, + FruityDelay, + FruityDelay2, + FruityFastDist, + FruityFastLP, + FruityFilter, + FruityFlanger, + FruityFormulaController, + FruityFreeFilter, + FruityHTMLNotebook, + FruityLSD, + FruityMute2, + FruityNotebook, + FruityPanOMatic, + FruityParametricEQ, + FruityPeakController, + FruityPhaseInverter, + FruityPhaser, + FruityReeverb, + FruityScratcher, + FruitySend, + FruitySoftClipper, + FruitySpectroman, + FruityStereoEnhancer, + FruityXYController + } ; + + FL_Plugin( PluginTypes _pt = UnknownPlugin ) : + pluginType( _pt ), + name(), + pluginSettings( NULL ), + pluginSettingsLength( 0 ) + { + } + + ~FL_Plugin() + { + delete[] pluginSettings; + } + + PluginTypes pluginType; + QString name; + + char * pluginSettings; + int pluginSettingsLength; + +} ; + + +struct FL_Channel : public FL_Plugin +{ + QList automationData; + + int volume; + int panning; + int baseNote; + int fxChannel; + int layerParent; + + typedef QList > noteVector; + noteVector notes; + + QList dots; + + + QString sampleFileName; + int sampleAmp; + bool sampleReversed; + bool sampleReverseStereo; + bool sampleUseLoopPoints; + + instrument * instrumentPlugin; + + QList envelopes; + + int filterType; + float filterCut; + float filterRes; + bool filterEnabled; + + int arpDir; + int arpRange; + int selectedArp; + float arpTime; + float arpGate; + bool arpEnabled; + + QRgb color; + + + FL_Channel( PluginTypes _pt = UnknownPlugin ) : + FL_Plugin( _pt ), + automationData(), + volume( DefaultVolume ), + panning( DefaultPanning ), + baseNote( DefaultKey ), + fxChannel( 0 ), + layerParent( -1 ), + notes(), + dots(), + sampleFileName(), + sampleAmp( 100 ), + sampleReversed( false ), + sampleReverseStereo( false ), + sampleUseLoopPoints( false ), + instrumentPlugin( NULL ), + envelopes(), + filterType( basicFilters<>::LowPass ), + filterCut( 10000 ), + filterRes( 0.1 ), + filterEnabled( false ), + arpDir( arpeggiator::ArpDirUp ), + arpRange( 0 ), + selectedArp( 0 ), + arpTime( 100 ), + arpGate( 100 ), + arpEnabled( false ), + color( qRgb( 64, 128, 255 ) ) + { + } + +} ; + + +struct FL_Effect : public FL_Plugin +{ + FL_Effect( PluginTypes _pt = UnknownPlugin ) : + FL_Plugin( _pt ), + fxChannel( 0 ), + fxPos( 0 ) + { + } + + int fxChannel; + int fxPos; + +} ; + + +struct FL_PlayListItem +{ + FL_PlayListItem() : + position( 0 ), + length( 1 ), + pattern( 0 ) + { + } + int position; + int length; + int pattern; +} ; + + +struct FL_EffectChannel +{ + FL_EffectChannel() : + name(), + volume( DefaultVolume ) + { + } + + QString name; + int volume; + bool isMuted; +} ; + + +struct FL_Project +{ + int mainVolume; + int mainPitch; + bpm_t tempo; + int numChannels; + + QList channels; + QList effects; + QList playListItems; + + QMap patternNames; + int maxPatterns; + int currentPattern; + int activeEditPattern; + + FL_EffectChannel effectChannels[NumFxChannels+1]; + int currentEffectChannel; + + QString projectNotes; + QString projectTitle; + + QString versionString; + int version; + int versionSpecificFactor; + + FL_Project() : + mainVolume( DefaultVolume ), + mainPitch( 0 ), + tempo( DefaultTempo ), + numChannels( 0 ), + channels(), + effects(), + playListItems(), + patternNames(), + maxPatterns( 0 ), + currentPattern( 0 ), + activeEditPattern( 0 ), + effectChannels(), + currentEffectChannel( -1 ), + projectNotes(), + projectTitle(), + versionString(), + version( 0x100 ), + versionSpecificFactor( 1 ) + { + } + +} ; + + + flpImport::flpImport( const QString & _file ) : importFilter( _file, &flpimport_plugin_descriptor ) @@ -129,26 +585,105 @@ flpImport::~flpImport() } - - bool flpImport::tryImport( trackContainer * _tc ) { - if( openFile() == FALSE ) + const int mappedFilter[] = { - return( FALSE ); + basicFilters<>::LowPass,// fast LP + basicFilters<>::LowPass, + basicFilters<>::BandPass_CSG, + basicFilters<>::HiPass, + basicFilters<>::Notch, + basicFilters<>::NumFilters+basicFilters<>::LowPass, + basicFilters<>::LowPass, + basicFilters<>::NumFilters+basicFilters<>::LowPass + } ; + + const arpeggiator::ArpDirections mappedArpDir[] = + { + arpeggiator::ArpDirUp, + arpeggiator::ArpDirUp, + arpeggiator::ArpDirDown, + arpeggiator::ArpDirUpAndDown, + arpeggiator::ArpDirUpAndDown, + arpeggiator::ArpDirRandom + } ; + + QMap mappedPluginTypes; + + // instruments + mappedPluginTypes["sampler"] = FL_Plugin::Sampler; + mappedPluginTypes["ts404"] = FL_Plugin::TS404; + mappedPluginTypes["3x osc"] = FL_Plugin::Fruity_3x_Osc; + mappedPluginTypes["beepmap"] = FL_Plugin::BeepMap; + mappedPluginTypes["buzz generator adapter"] = FL_Plugin::BuzzGeneratorAdapter; + mappedPluginTypes["fruit kick"] = FL_Plugin::FruitKick; + mappedPluginTypes["fruity drumsynth live"] = FL_Plugin::FruityDrumSynthLive; + mappedPluginTypes["fruity dx10"] = FL_Plugin::FruityDX10; + mappedPluginTypes["fruity granulizer"] = FL_Plugin::FruityGranulizer; + mappedPluginTypes["fruity slicer"] = FL_Plugin::FruitySlicer; + mappedPluginTypes["fruity soundfont player"] = FL_Plugin::FruitySoundfontPlayer; + mappedPluginTypes["fruity vibrator"] = FL_Plugin::FruityVibrator; + mappedPluginTypes["midi out"] = FL_Plugin::MidiOut; + mappedPluginTypes["plucked!"] = FL_Plugin::Plucked; + mappedPluginTypes["simsynth"] = FL_Plugin::SimSynth; + mappedPluginTypes["sytrus"] = FL_Plugin::Sytrus; + mappedPluginTypes["wasp"] = FL_Plugin::WASP; + + // effects + mappedPluginTypes["fruity 7 band EQ"] = FL_Plugin::Fruity7BandEq; + mappedPluginTypes["fruity balance"] = FL_Plugin::FruityBalance; + mappedPluginTypes["fruity bass boost"] = FL_Plugin::FruityBassBoost; + mappedPluginTypes["fruity big clock"] = FL_Plugin::FruityBigClock; + mappedPluginTypes["fruity blood overdrive"] = FL_Plugin::FruityBloodOverdrive; + mappedPluginTypes["fruity center"] = FL_Plugin::FruityCenter; + mappedPluginTypes["fruity chorus"] = FL_Plugin::FruityChorus; + mappedPluginTypes["fruity compressor"] = FL_Plugin::FruityCompressor; + mappedPluginTypes["fruity db meter"] = FL_Plugin::FruityDbMeter; + mappedPluginTypes["fruity delay"] = FL_Plugin::FruityDelay; + mappedPluginTypes["fruity delay 2"] = FL_Plugin::FruityDelay2; + mappedPluginTypes["fruity fast dist"] = FL_Plugin::FruityFastDist; + mappedPluginTypes["fruity fast lp"] = FL_Plugin::FruityFastLP; + mappedPluginTypes["fruity filter"] = FL_Plugin::FruityFilter; + mappedPluginTypes["fruity flanger"] = FL_Plugin::FruityFlanger; + mappedPluginTypes["fruity formula controller"] = FL_Plugin::FruityFormulaController; + mappedPluginTypes["fruity free filter"] = FL_Plugin::FruityFreeFilter; + mappedPluginTypes["fruity html notebook"] = FL_Plugin::FruityHTMLNotebook; + mappedPluginTypes["fruity lsd"] = FL_Plugin::FruityLSD; + mappedPluginTypes["fruity mute 2"] = FL_Plugin::FruityMute2; + mappedPluginTypes["fruity notebook"] = FL_Plugin::FruityNotebook; + mappedPluginTypes["fruity panomatic"] = FL_Plugin::FruityPanOMatic; + mappedPluginTypes["fruity parametric eq"] = FL_Plugin::FruityParametricEQ; + mappedPluginTypes["fruity peak controller"] = FL_Plugin::FruityPeakController; + mappedPluginTypes["fruity phase inverter"] = FL_Plugin::FruityPhaseInverter; + mappedPluginTypes["fruity phaser"] = FL_Plugin::FruityPhaser; + mappedPluginTypes["fruity reeverb"] = FL_Plugin::FruityReeverb; + mappedPluginTypes["fruity scratcher"] = FL_Plugin::FruityScratcher; + mappedPluginTypes["fruity send"] = FL_Plugin::FruitySend; + mappedPluginTypes["fruity soft clipper"] = FL_Plugin::FruitySoftClipper; + mappedPluginTypes["fruity spectroman"] = FL_Plugin::FruitySpectroman; + mappedPluginTypes["fruity stereo enhancer"] = FL_Plugin::FruityStereoEnhancer; + mappedPluginTypes["fruity x-y controller"] = FL_Plugin::FruityXYController; + + + FL_Project p; + + if( openFile() == false ) + { + return false; } if( readID() != makeID( 'F', 'L', 'h', 'd' ) ) { printf( "flpImport::tryImport(): not a valid FL project\n" ); - return( FALSE ); + return false; } const int header_len = read32LE(); if( header_len != 6 ) { printf( "flpImport::tryImport(): invalid file format\n" ); - return( FALSE ); + return false; } const int type = read16LE(); @@ -156,30 +691,31 @@ bool flpImport::tryImport( trackContainer * _tc ) { printf( "flpImport::tryImport(): type %d format is not " "supported\n", type ); - return( FALSE ); + return false; } - const int num_channels = read16LE(); - if( num_channels < 1 || num_channels > 1000 ) + p.numChannels = read16LE(); + if( p.numChannels < 1 || p.numChannels > 1000 ) { printf( "flpImport::tryImport(): invalid number of channels " - "(%d)\n", num_channels ); - return( FALSE ); + "(%d)\n", p.numChannels ); + return false; } const int ppq = read16LE(); if( ppq < 0 ) { printf( "flpImport::tryImport(): invalid ppq\n" ); - return( FALSE ); + return false; } - QProgressDialog pd( trackContainer::tr( "Importing FLP-file..." ), - trackContainer::tr( "Cancel" ), 0, num_channels ); - pd.setWindowTitle( trackContainer::tr( "Please wait..." ) ); - pd.show(); + QProgressDialog progressDialog( + trackContainer::tr( "Importing FLP-file..." ), + trackContainer::tr( "Cancel" ), 0, p.numChannels ); + progressDialog.setWindowTitle( trackContainer::tr( "Please wait..." ) ); + progressDialog.show(); - bool valid = FALSE; + bool valid = false; // search for FLdt chunk while( 1 ) @@ -190,66 +726,48 @@ bool flpImport::tryImport( trackContainer * _tc ) { printf( "flpImport::tryImport(): unexpected " "end of file\n" ); - return( FALSE ); + return false; } if( len < 0 || len >= 0x10000000 ) { printf( "flpImport::tryImport(): invalid " "chunk length %d\n", len ); - return( FALSE ); + return false; } if( id == makeID( 'F', 'L', 'd', 't' ) ) { - valid = TRUE; + valid = true; break; } skip( len ); } - if( valid == FALSE ) + if( valid == false ) { - return( FALSE ); + return false; } - printf( "channels: %d\n", num_channels ); - - instrumentTrack * it = NULL; - instrument * it_inst = NULL; - flPlugins cur_plugin = FL_Plugin_Undef; - - int current_pattern = 0; - char * text = NULL; - Uint32 text_len = 0; - QList i_tracks; - int project_cur_pat = 0; - - int step_pattern = 0; - int last_step_pos = 0; - - int env_lfo_target = 0; - - int ev_cnt = 0; - - engine::getSong()->clearProject(); - const bool is_journ = engine::getProjectJournal()->isJournalling(); - engine::getProjectJournal()->setJournalling( FALSE ); - - - while( file().atEnd() == FALSE ) + for( int i = 0; i < p.numChannels; ++i ) { - if( ++ev_cnt > 100 ) - { - ev_cnt = 0; - qApp->processEvents( QEventLoop::AllEvents, 100 ); - pd.setValue( i_tracks.size() ); + p.channels += FL_Channel(); + } - if( pd.wasCanceled() ) - { - return( FALSE ); - } - } + printf( "channels: %d\n", p.numChannels ); - flpEvents ev = static_cast( readByte() ); + + char * text = NULL; + int text_len = 0; + FL_Plugin::PluginTypes last_plugin_type = FL_Plugin::UnknownPlugin; + + int cur_channel = -1; + + const bool is_journ = engine::getProjectJournal()->isJournalling(); + engine::getProjectJournal()->setJournalling( false ); + + + while( file().atEnd() == false ) + { + FLP_Events ev = static_cast( readByte() ); Uint32 data = readByte(); if( ev >= FLP_Word && ev < FLP_Text ) @@ -285,6 +803,12 @@ bool flpImport::tryImport( trackContainer * _tc ) text[text_len] = 0; } + const unsigned char * puc = (const unsigned char*) text; + const int * pi = (const int *) text; + + + FL_Channel * cc = cur_channel >= 0 ? + &p.channels[cur_channel] : NULL; switch( ev ) { @@ -298,6 +822,14 @@ bool flpImport::tryImport( trackContainer * _tc ) // data = pos how to handle? break; + case FLP_Vol: + printf( "vol %d\n", data ); + break; + + case FLP_Pan: + printf( "pan %d\n", data ); + break; + case FLP_LoopActive: printf( "active loop: %d\n", data ); break; @@ -311,71 +843,89 @@ bool flpImport::tryImport( trackContainer * _tc ) break; case FLP_MainVol: - printf( "main-volume: %d\n", data ); - engine::getSong()->setMasterVolume( - static_cast( data * 100 / - 128 ) ); + p.mainVolume = data * 100 / 128; break; case FLP_PatLength: - printf( "pattern-length: %d\n", data ); + printf( "pattern length: %d\n", data ); break; case FLP_BlockLength: printf( "block length: %d\n", data ); break; + case FLP_UseLoopPoints: + cc->sampleUseLoopPoints = true; + break; + case FLP_LoopType: printf( "loop type: %d\n", data ); break; case FLP_ChanType: printf( "channel type: %d\n", data ); + if( cc ) + { + switch( data ) + { + case 0: cc->pluginType = FL_Plugin::Sampler; break; + case 1: cc->pluginType = FL_Plugin::TS404; break; +// case 2: cc->pluginType = FL_Plugin::Fruity_3x_Osc; break; + case 3: cc->pluginType = FL_Plugin::Layer; break; + default: + break; + } + } break; case FLP_MixSliceNum: - printf( "mix slice num: %d\n", data ); + cc->fxChannel = data+1; + break; + + case FLP_EffectChannelMuted: +if( p.currentEffectChannel <= NumFxChannels ) +{ + p.effectChannels[p.currentEffectChannel].isMuted = + ( data & 0x08 ) > 0 ? false : true; +} break; // WORD EVENTS case FLP_NewChan: - printf( "new channel\n" ); - - it = dynamic_cast( - track::create( track::InstrumentTrack, engine::getBBTrackContainer() ) ); - assert( it != NULL ); - i_tracks.push_back( it ); - it_inst = it->loadInstrument( - "audiofileprocessor" ); -// it->toggledInstrumentTrackButton( FALSE ); - - // reset some values - step_pattern = 0; - last_step_pos = 0; - env_lfo_target = 0; - + cur_channel = data; + printf( "new channel: %d\n", data ); break; case FLP_NewPat: - current_pattern = data - 1; + p.currentPattern = data - 1; + if( p.currentPattern > p.maxPatterns ) + { + p.maxPatterns = p.currentPattern; + } break; case FLP_Tempo: - printf( "tempo: %d\n", data ); - engine::getSong()->setTempo( data ); + p.tempo = data; break; case FLP_CurrentPatNum: - project_cur_pat = data; + p.activeEditPattern = data; break; case FLP_FX: - printf( "FX-channel for cur channel: %d\n", - data ); + printf( "FX: %d\n", data ); break; case FLP_Fade_Stereo: + if( data & 0x02 ) + { + cc->sampleReversed = true; + } + else if( data & 0x100 ) + { + cc->sampleReverseStereo = true; + } printf( "fade stereo: %d\n", data ); break; @@ -384,7 +934,7 @@ bool flpImport::tryImport( trackContainer * _tc ) break; case FLP_PreAmp: - printf( "pre-amp (sample): %d\n", data ); + cc->sampleAmp = 100 + data * 100 / 256; break; case FLP_Decay: @@ -396,7 +946,7 @@ bool flpImport::tryImport( trackContainer * _tc ) break; case FLP_MainPitch: - engine::getSong()->setMasterPitch( data ); + p.mainPitch = data; break; case FLP_Resonance: @@ -420,31 +970,30 @@ bool flpImport::tryImport( trackContainer * _tc ) break; case FLP_Dot: - { - printf( "dot/step at: %d\n", data ); - const int pos = data & 0xff; - if( last_step_pos > pos ) - { - ++step_pattern; - } - last_step_pos = pos; - m_steps.push_back( - ( ( i_tracks.size() - 1 ) << 16 ) | - ( pos + 16 * step_pattern ) ); + cc->dots.push_back( ( data & 0xff ) + + ( p.currentPattern << 8 ) ); break; - } + + case FLP_LayerChans: + p.channels[data].layerParent = cur_channel; // DWORD EVENTS case FLP_Color: - printf( "color r:%d g:%d b:%d\n", - qRed( data ), - qGreen( data ), - qBlue( data ) ); + cc->color = data; break; case FLP_PlayListItem: { - m_plItems.push_back( data ); + FL_PlayListItem i; + i.position = ( data & 0xffff ) * + DefaultTicksPerTact; + i.length = DefaultTicksPerTact; + i.pattern = ( data >> 16 ) - 1; + p.playListItems.push_back( i ); + if( i.pattern > p.maxPatterns ) + { + p.maxPatterns = i.pattern; + } break; } @@ -457,8 +1006,7 @@ bool flpImport::tryImport( trackContainer * _tc ) break; case FLP_MiddleNote: - data += 8; - it->baseNoteModel()->setValue( data ); + cc->baseNote = data+9; break; case FLP_DelayReso: @@ -475,14 +1023,11 @@ bool flpImport::tryImport( trackContainer * _tc ) // TEXT EVENTS case FLP_Text_ChanName: - if( it == NULL ) - { - printf( "!! tried to set channel name " - "but no channel was created so " - "far\n" ); - break; - } - it->setName( text ); + cc->name = text; + break; + + case FLP_Text_PatName: + p.patternNames[p.currentPattern] = text; break; case FLP_Text_CommentRTF: @@ -500,25 +1045,17 @@ bool flpImport::tryImport( trackContainer * _tc ) word_free( word ); op_free( op ); - engine::getProjectNotes()->setText( out ); + p.projectNotes = out; outstring = ""; break; } case FLP_Text_Title: - printf( "project title: %s\n", text ); + p.projectTitle = text; break; case FLP_Text_SampleFileName: { - if( it_inst == NULL ) - { - printf( "!! tried to set sample for " - "instrument but no channel or " - "instrument was " - "created so far\n" ); - break; - } QString f = text; /* if( f.mid( 1, 11 ) == "Instruments" ) { @@ -538,223 +1075,313 @@ bool flpImport::tryImport( trackContainer * _tc ) f = configManager::inst()->flDir() + "/Samples/" + f; } - it_inst->loadFile( f ); + cc->sampleFileName = f; break; } - case FLP_Version: - printf( "FL Version: %s\n", text ); + case FLP_Text_Version: + { + printf( "FLP version: %s\n", text ); + p.versionString = text; + QStringList l = p.versionString.split( '.' ); + p.version = ( l[0].toInt() << 8 ) + + ( l[1].toInt() << 4 ) + + ( l[2].toInt() << 0 ); + if( p.version >= 0x600 ) + { + p.versionSpecificFactor = 100; + } break; + } case FLP_Text_PluginName: - { - instrument * new_inst = NULL; - if( QString( text ) == "3x Osc" ) + if( mappedPluginTypes. + contains( QString( text ).toLower() ) ) { - printf( "loading TripleOscillator for " - "3x Osc\n" ); - new_inst = it->loadInstrument( - "tripleoscillator" ); - cur_plugin = FL_Plugin_3x_Osc; - } - else if( QString( text ) == "Plucked!" ) - { - printf( "loading Vibed for Plucked!\n" - ); - new_inst = it->loadInstrument( - "vibedstrings" ); - cur_plugin = FL_Plugin_Plucked; + const FL_Plugin::PluginTypes t = static_cast( + mappedPluginTypes[QString( text ).toLower()] ); + if( t > FL_Plugin::EffectPlugin ) + { + printf( "recognized new " + "effect %s\n", text ); + p.effects.push_back( + FL_Effect( t ) ); + } + else if( cc ) + { + printf( "recognized new " + "plugin %s\n", text ); + cc->pluginType = t; + } + last_plugin_type = t; } else { printf( "unsupported plugin: %s!\n", text ); } - if( new_inst != NULL ) - { - it_inst = new_inst; - } break; - } - case FLP_Delay: - printf( "delay-data:\n" ); + case FLP_Text_EffectChanName: +++p.currentEffectChannel; +if( p.currentEffectChannel <= NumFxChannels ) +{ + p.effectChannels[p.currentEffectChannel].name = text; +} + break; + + case FLP_Text_Delay: + printf( "delay data: " ); + // pi[1] seems to be volume or similiar and + // needs to be divided + // by p.versionSpecificFactor dump_mem( text, text_len ); break; - case FLP_NewPlugin: - printf( "new plugin: %s\n", text ); - break; - - case FLP_PluginParams: - if( it_inst != NULL && - cur_plugin != FL_Plugin_Undef ) + case FLP_Text_TS404Params: + if( cc && cc->pluginType == + FL_Plugin::UnknownPlugin && + cc->pluginSettings == NULL ) { - processPluginParams( cur_plugin, - (const char *) text, - text_len, it_inst ); - cur_plugin = FL_Plugin_Undef; + cc->pluginSettings = new char[text_len]; + memcpy( cc->pluginSettings, text, + text_len ); + cc->pluginSettingsLength = text_len; + cc->pluginType = + FL_Plugin::TS404; } break; - case FLP_ChanParams: - { - const arpeggiator::ArpDirections - mappedArpDir[] = + case FLP_Text_NewPlugin: + if( last_plugin_type > FL_Plugin::EffectPlugin ) { - arpeggiator::ArpDirUp, - arpeggiator::ArpDirUp, - arpeggiator::ArpDirDown, - arpeggiator::ArpDirUpAndDown, - arpeggiator::ArpDirUpAndDown, - arpeggiator::ArpDirRandom - } ; - const Uint32 * p = (const Uint32 *) text; - arpeggiator * arp = &it->m_arpeggiator; - arp->m_arpDirectionModel.setValue( - mappedArpDir[p[10]] ); - arp->m_arpRangeModel.setValue( p[11] ); - arp->m_arpModel.setValue( p[12] ); - arp->m_arpTimeModel.setValue( p[13] / 8.0f ); - //// 100.0f ); - arp->m_arpGateModel.setValue( p[14] * 100.0f / - 48.0f ); - arp->m_arpEnabledModel.setValue( p[10] > 0 ); + FL_Effect * e = &p.effects.last(); + e->fxChannel = puc[0]; + e->fxPos = puc[4]; + printf( "new effect: " ); + } + else + { + printf( "new plugin: " ); + } + dump_mem( text, text_len ); + break; + + case FLP_Text_PluginParams: + if( cc && cc->pluginSettings == NULL ) + { + cc->pluginSettings = new char[text_len]; + memcpy( cc->pluginSettings, text, + text_len ); + cc->pluginSettingsLength = text_len; + } + printf( "plugin params: " ); + dump_mem( text, text_len ); + break; + + case FLP_Text_ChanParams: + cc->arpDir = mappedArpDir[pi[10]]; + cc->arpRange = pi[11]; + cc->selectedArp = pi[12]; + if( cc->selectedArp < 8 ) + { + const int mappedArps[] = { 0, 1, 5, 6, 2, 3, 4 } ; + cc->selectedArp = mappedArps[cc->selectedArp]; + } + cc->arpTime = ( ( pi[13]+1 ) * p.tempo ) / + ( 4*16 ) + 1; + cc->arpGate = ( pi[14] * 100.0f ) / 48.0f; + cc->arpEnabled = pi[10] > 0; + printf( "channel params: " ); dump_mem( text, text_len ); - //printf( "channel params: arpdir: %d range: %d time: %d gate: %d\n", p[10], p[11], p[13], p[14] ); break; - } - case FLP_EnvLfoParams: + case FLP_Text_EnvLfoParams: { - const Uint32 * p = (const Uint32 *) text; - printf( "envelope and lfo params: " ); + const float scaling = 1.0 / 65536.0f; + FL_Channel_Envelope e; + + switch( cc->envelopes.size() ) + { + case 1: + e.target = instrumentSoundShaping::Volume; + break; + case 2: + e.target = instrumentSoundShaping::Cut; + break; + case 3: + e.target = instrumentSoundShaping::Resonance; + break; + default: + e.target = instrumentSoundShaping::NumTargets; + break; + } + e.predelay = pi[2] * scaling; + e.attack = pi[3] * scaling; + e.hold = pi[4] * scaling; + e.decay = pi[5] * scaling; + e.sustain = 1-pi[6] / 128.0f; + e.release = pi[7] * scaling; + if( e.target == instrumentSoundShaping::Volume ) + { + e.amount = pi[1] ? 1 : 0; + } + else + { + e.amount = pi[8] / 128.0f; + } +// e.lfoAmount = pi[11] / 128.0f; + cc->envelopes.push_back( e ); + + printf( "envelope and lfo params:\n" ); dump_mem( text, text_len ); - instrumentSoundShaping * iss = &it->m_soundShaping; - envelopeAndLFOParameters * elp = NULL; - switch( env_lfo_target ) - { - case 1: - elp = iss->m_envLFOParameters[instrumentSoundShaping::Volume]; - break; - case 2: - elp = iss->m_envLFOParameters[instrumentSoundShaping::Cut]; - break; - case 3: - elp = iss->m_envLFOParameters[instrumentSoundShaping::Resonance]; - break; - default: - break; - } - ++env_lfo_target; - if( elp == NULL ) - { - break; - } - const float scaling = 0.8f / 65536.0f; - elp->m_predelayModel.setValue( p[2] * scaling ); - elp->m_attackModel.setValue( p[3] * scaling ); - elp->m_holdModel.setValue( p[4] * scaling ); - elp->m_decayModel.setValue( p[5] * scaling ); - elp->m_sustainModel.setValue( p[6] * scaling ); - elp->m_releaseModel.setValue( p[7] * scaling ); - elp->m_amountModel.setValue( p[1] ? 1 : 0 ); - elp->updateSampleVars(); + break; } - case FLP_FilterParams: + case FLP_Text_BasicChanParams: + cc->volume = ( pi[1] / p.versionSpecificFactor ) * 100 / 128; + cc->panning = ( pi[0] / p.versionSpecificFactor ) * 200 / 128 - + PanningRight; + if( text_len > 12 ) + { + cc->filterType = mappedFilter[puc[20]]; + cc->filterCut = puc[12] / ( 255.0f * 2.5f ); + cc->filterRes = 0.01f + puc[16] / ( 256.0f * 2 ); + cc->filterEnabled = ( puc[13] == 0 ); + if( puc[20] >= 6 ) { - // TODO: Dirty hack! - // SIMPLE_FLT_CNT equals to old DOUBLE_LOWPASS - const basicFilters<>::filterTypes - mappedFilter[] = - { - basicFilters<>::LowPass,// fast LP - basicFilters<>::LowPass, - basicFilters<>::BandPass_CSG, - basicFilters<>::HiPass, - basicFilters<>::Notch, - basicFilters<>::NumOfFilters, - basicFilters<>::LowPass, - basicFilters<>::NumOfFilters - } ; - Uint32 * p = (Uint32 *) text; - instrumentSoundShaping * iss = &it->m_soundShaping; -/* printf( "filter values: " ); - for( int i = 0; i < 6; ++i ) - { - printf( "%d ", ((Sint32*)text)[i] ); + cc->filterCut *= 0.5f; + } + } + printf( "basic chan params: " ); + dump_mem( text, text_len ); + break; + + case FLP_Text_OldFilterParams: + cc->filterType = mappedFilter[puc[8]]; + cc->filterCut = puc[0] / ( 255.0f * 2.5 ); + cc->filterRes = 0.1f + puc[4] / ( 256.0f * 2 ); + cc->filterEnabled = ( puc[1] == 0 ); + if( puc[8] >= 6 ) + { + cc->filterCut *= 0.5; + } + printf( "old filter params: " ); + dump_mem( text, text_len ); + break; + + case FLP_Text_AutomationData: + { + const int bpae = 12; + const int imax = text_len / bpae; + printf( "automation data (%d items)\n", imax ); + for( int i = 0; i < imax; ++i ) + { + FL_Automation a; + a.pos = pi[3*i+0] / + ( 4*ppq / DefaultTicksPerTact ); + a.value = pi[3*i+2]; + a.channel = pi[3*i+1] >> 16; + a.control = pi[3*i+1] & 0xffff; + if( a.channel >= 0 && + a.channel < p.numChannels ) + { +printf("add channel %d at %d val %d control:%d\n", a.channel, a.pos, a.value, a.control ); + p.channels[a.channel].automationData += a; + } +// dump_mem( text+i*bpae, bpae ); } - printf( "\n" );*/ - iss->m_filterModel.setValue( - mappedFilter[p[5]] ); - iss->m_filterCutModel.setValue( p[3] / 255.0f * - ( iss->m_filterCutModel.maxValue() - - iss->m_filterCutModel.minValue() ) + - iss->m_filterCutModel.minValue() ); - iss->m_filterResModel.setValue( p[4] / 1024.0f * - ( iss->m_filterResModel.maxValue() - - iss->m_filterResModel.minValue() ) + - iss->m_filterResModel.minValue() ); - iss->m_filterEnabledModel.setValue( p[3] < 256 ); break; } - case FLP_PatternNotes: + case FLP_Text_PatternNotes: { //dump_mem( text, text_len ); const int bpn = 20; - Uint32 imax = ( text_len + bpn - 1 ) / bpn; - for( Uint32 i = 0; i < imax; ++i ) + const int imax = ( text_len + bpn - 1 ) / bpn; + for( int i = 0; i < imax; ++i ) { - int ch = *( text + i*bpn + 6 ); - int pos = *( (int *)( text + i*bpn ) ); - int key = *( text + i*bpn + 12 ); - int len = *( (int*)( text + i*bpn + + int ch = *( puc + i*bpn + 6 ); + int pan = *( puc + i*bpn + 16 ); + int vol = *( puc + i*bpn + 17 ); + int pos = *( (int *)( puc + i*bpn ) ); + int key = *( puc + i*bpn + 12 ); + int len = *( (int*)( puc + i*bpn + 8 ) ); - pos /= 384 / DefaultTicksPerTact; - len /= 384 / DefaultTicksPerTact; - note n( len, pos ); - n.setKey( key ); - m_notes.push_back( qMakePair( - num_channels * current_pattern + ch, n ) ); - - //printf( "note on channel %d at pos %d with key %d and length %d ", (int)*((text+i*bpn+6)), *((int*)(text+i*bpc)), (int) *(text+i*bpc+12), (int) *((int*)(text+i*bpc+8))); - //printf( "note on channel %d at pos %d with key %d and length %d\n", ch, pos, key, len ); - - //dump_mem( text+i*bpn+4, bpc-4 ); + pos /= (4*ppq) / DefaultTicksPerTact; + len /= (4*ppq) / DefaultTicksPerTact; + note n( len, pos, key, vol * 100 / 128, + pan*200 / 128 - 100 ); + p.channels[ch].notes.push_back( qMakePair( p.currentPattern, n ) ); + printf( "note: " ); + dump_mem( text+i*bpn, bpn ); } break; } - case FLP_StepData: + case FLP_Text_ChanGroupName: + printf( "channel group name: %s\n", text ); + break; + + // case 216: pi[2] /= p.versionSpecificFactor + // case 229: pi[1] /= p.versionSpecificFactor + + case 225: { - printf( "step data:\n" ); - dump_mem( text, text_len ); -#if 0 - const int bpn = 20; - for( int i = 0; i*bpn < text_len; ++i ) + enum FLP_EffectParams { - int ch = *( text + i*bpn + 6 ); - int pos = *( (int *)( text + i*bpn ) ); - int key = *( text + i*bpn + 12 ); - int len = *( (int*)( text + i*bpn + - 8 ) ); - pos /= 512 / DefaultTicksPerTact; - len /= 512 / DefaultTicksPerTact; - /*note n( NULL, len, pos ); - n.setKey( key ); - m_notes.push_back( qMakePair( - num_channels * current_pattern + ch, n ) );*/ - - //printf( "note on channel %d at pos %d with key %d and length %d ", (int)*((text+i*bpn+6)), *((int*)(text+i*bpc)), (int) *(text+i*bpc+12), (int) *((int*)(text+i*bpc+8))); - //printf( "step-note (?) on channel %d at pos %d with key %d and length %d\n", ch, pos, key, len ); - - dump_mem( text+i*bpn, bpn ); + EffectParamVolume = 0x1fc0 + } ; + + const int bpi = 12; + const int imax = text_len / bpi; + for( int i = 0; i < imax; ++i ) + { + const int param = pi[i*3+1] & 0xffff; + const int ch = ( pi[i*3+1] >> 22 ) + & 0x7f; + if( ch < 0 || ch > NumFxChannels ) + { + continue; + } + const int val = pi[i*3+2]; + if( param == EffectParamVolume ) + { +p.effectChannels[ch].volume = ( val / p.versionSpecificFactor ) * 100 / 128; + } + else + { +printf("FX-ch: %d param: %x value:%x\n", ch, param, val ); + } + } + break; + } + + case 233: // playlist items + { + const int bpi = 28; + const int imax = text_len / bpi; + for( int i = 0; i < imax; ++i ) + { +const int pos = pi[i*bpi/sizeof(int)+0] / ( (4*ppq) / DefaultTicksPerTact ); +const int len = pi[i*bpi/sizeof(int)+2] / ( (4*ppq) / DefaultTicksPerTact ); +const int pat = pi[i*bpi/sizeof(int)+3] & 0xfff; +if( pat > 2146 && pat <= 2278 ) // whatever these magic numbers are for... +{ + FL_PlayListItem i; + i.position = pos; + i.length = len; + i.pattern = 2278 - pat; + p.playListItems += i; +} +else +{ + printf( "playlist item: " ); + dump_mem( text+i*bpi, bpi ); +} } -#endif break; } @@ -762,7 +1389,7 @@ bool flpImport::tryImport( trackContainer * _tc ) if( ev >= FLP_Text ) { printf( "!! unhandled text (ev: %d, " - "len: %d):\n", + "len: %d): ", ev, text_len ); dump_mem( text, text_len ); } @@ -774,96 +1401,415 @@ bool flpImport::tryImport( trackContainer * _tc ) } break; } +/* if( ev >= FLP_Text ) + { + printf( "dump (ev: %d, len: %d): ", ev, text_len ); + dump_mem( text, text_len ); + }*/ } - // process all steps - for( stepVector::const_iterator it = m_steps.begin(); - it != m_steps.end(); ++it ) + + // now create a project from FL_Project data structure + + engine::getSong()->clearProject(); + + // set global parameters + engine::getSong()->setMasterVolume( p.mainVolume ); + engine::getSong()->setMasterPitch( p.mainPitch ); + engine::getSong()->setTempo( p.tempo ); + + // set project notes + engine::getProjectNotes()->setText( p.projectNotes ); + + + progressDialog.setMaximum( p.maxPatterns + p.channels.size() + + p.effects.size() ); + int cur_progress = 0; + + // create BB tracks + QList bb_tracks; + QList i_tracks; + + while( engine::getBBTrackContainer()->numOfBBs() <= p.maxPatterns ) { - const int ch = ( *it ) >> 16; - const int pat = ( ( *it ) & 0xffff ) / 16; - const int pos = ( ( ( *it ) & 0xffff ) % 16 ) * - (DefaultTicksPerTact/16); - while( engine::getBBTrackContainer()->numOfBBs() <= pat ) + const int cur_pat = bb_tracks.size(); + bbTrack * bbt = dynamic_cast( + track::create( track::BBTrack, engine::getSong() ) ); + if( p.patternNames.contains( cur_pat ) ) { - track::create( track::BBTrack, engine::getSong() ); + bbt->setName( p.patternNames[cur_pat] ); } - pattern * p = dynamic_cast( - i_tracks[ch]->getTCO( pat ) ); - if( p == NULL ) - { - continue; - } - p->addNote( note( -DefaultTicksPerTact, pos ), FALSE ); + bb_tracks += bbt; + progressDialog.setValue( ++cur_progress ); + qApp->processEvents(); } - // now process all notes - for( patternNoteVector::const_iterator it = m_notes.begin(); - it != m_notes.end(); ++it ) + // create instrument-track for each channel + for( QList::iterator it = p.channels.begin(); + it != p.channels.end(); ++it ) { - const int where = ( *it ).first; - const int ch = where % num_channels; - const int pat = where / num_channels; - if( pat > 100 ) + instrumentTrack * t = dynamic_cast( + track::create( track::InstrumentTrack, + engine::getBBTrackContainer() ) ); + engine::getBBTrackContainer()->updateAfterTrackAdd(); + i_tracks.push_back( t ); + switch( it->pluginType ) + { + case FL_Plugin::Fruity_3x_Osc: + it->instrumentPlugin = + t->loadInstrument( "tripleoscillator" ); + break; + case FL_Plugin::Plucked: + it->instrumentPlugin = + t->loadInstrument( "vibedstrings" ); + break; + case FL_Plugin::FruitKick: + it->instrumentPlugin = + t->loadInstrument( "kicker" ); + break; + case FL_Plugin::TS404: + it->instrumentPlugin = + t->loadInstrument( "lb302" ); + break; + case FL_Plugin::FruitySoundfontPlayer: + it->instrumentPlugin = + t->loadInstrument( "sf2player" ); + break; + case FL_Plugin::Sampler: + case FL_Plugin::UnknownPlugin: + default: + it->instrumentPlugin = + t->loadInstrument( + "audiofileprocessor" ); + break; + } + processPluginParams( &( *it ) ); + + t->setName( it->name ); + t->volumeModel()->setValue( it->volume ); + t->panningModel()->setValue( it->panning ); + t->baseNoteModel()->setValue( it->baseNote ); + t->effectChannelModel()->setValue( it->fxChannel ); + + instrumentSoundShaping * iss = &t->m_soundShaping; + iss->m_filterModel.setValue( it->filterType ); + iss->m_filterCutModel.setValue( it->filterCut * + ( iss->m_filterCutModel.maxValue() - + iss->m_filterCutModel.minValue() ) + + iss->m_filterCutModel.minValue() ); + iss->m_filterResModel.setValue( it->filterRes * + ( iss->m_filterResModel.maxValue() - + iss->m_filterResModel.minValue() ) + + iss->m_filterResModel.minValue() ); + iss->m_filterEnabledModel.setValue( it->filterEnabled ); + + for( QList::iterator jt = + it->envelopes.begin(); + jt != it->envelopes.end(); ++jt ) + { + if( jt->target != instrumentSoundShaping::NumTargets ) + { + envelopeAndLFOParameters * elp = + iss->m_envLFOParameters[jt->target]; + + elp->m_predelayModel.setValue( jt->predelay ); + elp->m_attackModel.setValue( jt->attack ); + elp->m_holdModel.setValue( jt->hold ); + elp->m_decayModel.setValue( jt->decay ); + elp->m_sustainModel.setValue( jt->sustain ); + elp->m_releaseModel.setValue( jt->release ); + elp->m_amountModel.setValue( jt->amount ); + elp->updateSampleVars(); + } + } + + arpeggiator * arp = &t->m_arpeggiator; + arp->m_arpDirectionModel.setValue( it->arpDir ); + arp->m_arpRangeModel.setValue( it->arpRange ); + arp->m_arpModel.setValue( it->selectedArp ); + arp->m_arpTimeModel.setValue( it->arpTime ); + arp->m_arpGateModel.setValue( it->arpGate ); + arp->m_arpEnabledModel.setValue( it->arpEnabled ); + + // process all dots + for( QList::const_iterator jt = it->dots.begin(); + jt != it->dots.end(); ++jt ) + { + const int pat = *jt / 256; + const int pos = *jt % 256; + pattern * p = + dynamic_cast( t->getTCO( pat ) ); + if( p == NULL ) + { + continue; + } + p->setStep( pos, true ); + } + + // TODO: use future layering feature + if( it->layerParent >= 0 ) + { + it->notes += p.channels[it->layerParent].notes; + } + + // process all notes + for( FL_Channel::noteVector::const_iterator jt = + it->notes.begin(); + jt != it->notes.end(); ++jt ) + { + const int pat = jt->first; + + if( pat > 100 ) + { + continue; + } + pattern * p = dynamic_cast( + t->getTCO( pat ) ); + if( p != NULL ) + { + p->addNote( jt->second, false ); + } + } + + // process automation data + for( QList::const_iterator jt = + it->automationData.begin(); + jt != it->automationData.end(); ++jt ) + { + automatableModel * m = NULL; + float value = jt->value; + bool scale = false; + switch( jt->control ) + { + case FL_Automation::ControlVolume: + m = t->volumeModel(); + value *= ( 100.0f / 128.0f ) / + p.versionSpecificFactor; + break; + case FL_Automation::ControlPanning: + m = t->panningModel(); + value = ( value / p.versionSpecificFactor ) *200/128 - PanningRight; + break; + case FL_Automation::ControlPitch: + m = t->pitchModel(); + break; + case FL_Automation::ControlFXChannel: + m = t->effectChannelModel(); + value = value*200/128 - PanningRight; + break; + case FL_Automation::ControlFilterCut: + scale = true; + m = &t->m_soundShaping.m_filterCutModel; + value /= ( 255 * 2.5f ); + break; + case FL_Automation::ControlFilterRes: + scale = true; + m = &t->m_soundShaping.m_filterResModel; + value = 0.1f + value / ( 256.0f * 2 ); + break; + case FL_Automation::ControlFilterType: + m = &t->m_soundShaping.m_filterModel; + value = mappedFilter[jt->value]; + break; + default: + printf( "handling automation data of " + "control %d not implemented " + "yet\n", jt->control ); + break; + } + if( m ) + { +if( scale ) +{ + value = m->minValue() + value * + ( m->maxValue() - m->minValue() ); +} +automationPattern * p = automationPattern::globalAutomationPattern( m ); +p->putValue( jt->pos, value, false ); + } + } + + progressDialog.setValue( ++cur_progress ); + qApp->processEvents(); + } + + // process all effects + effectKeyList effKeys; + QVector pluginDescs; + plugin::getDescriptorsOfAvailPlugins( pluginDescs ); + for( QVector::iterator it = pluginDescs.begin(); + it != pluginDescs.end(); ++it ) + { + if( it->type != plugin::Effect ) { continue; } - while( engine::getBBTrackContainer()->numOfBBs() <= pat ) + if( it->sub_plugin_features ) { - track::create( track::BBTrack, engine::getSong() ); - qApp->processEvents( QEventLoop::AllEvents, 100 ); + it->sub_plugin_features->listSubPluginKeys( + &( *it ), effKeys ); } - pattern * p = dynamic_cast( - i_tracks[ch]->getTCO( pat ) ); - if( p != NULL ) + else { - p->addNote( ( *it ).second, FALSE ); + effKeys << effectKey( &( *it ), it->name ); + } } + for( int fx_ch = 0; fx_ch <= NumFxChannels ; ++fx_ch ) + { + fxChannel * ch = engine::getFxMixer()->getEffectChannel( + fx_ch ); + if( !ch ) + { + continue; + } + FL_EffectChannel * flch = &p.effectChannels[fx_ch]; + if( !flch->name.isEmpty() ) + { + ch->m_name = flch->name; + } + ch->m_volumeModel.setValue( flch->volume / 100.0f ); + ch->m_muteModel.setValue( flch->isMuted ); + } + + for( QList::const_iterator it = p.effects.begin(); + it != p.effects.end(); ++it ) + { + QString effName; + switch( it->pluginType ) + { + case FL_Plugin::Fruity7BandEq: + effName = "C* Eq2x2"; + break; + case FL_Plugin::FruityBassBoost: + effName = "BassBooster"; + break; + case FL_Plugin::FruityChorus: + effName = "TAP Chorus"; + break; + case FL_Plugin::FruityCompressor: + //effName = "C* Compress"; + effName = "Fast Lookahead limiter"; + break; + case FL_Plugin::FruityDelay: + case FL_Plugin::FruityDelay2: +// effName = "Feedback Delay Line (Maximum Delay 5s)"; + break; + case FL_Plugin::FruityBloodOverdrive: + case FL_Plugin::FruityFastDist: + case FL_Plugin::FruitySoftClipper: + effName = "C* Clip"; + break; + case FL_Plugin::FruityFastLP: + effName = "Low Pass Filter"; + break; + case FL_Plugin::FruityPhaser: + effName = "C* PhaserI"; + break; + case FL_Plugin::FruityReeverb: + effName = "C* Plate2x2"; + break; + case FL_Plugin::FruitySpectroman: + effName = "Spectrum Analyzer"; + break; + default: + break; + } + if( effName.isEmpty() || it->fxChannel < 0 || + it->fxChannel > 64 ) + { + continue; + } + effectChain * ec = engine::getFxMixer()->getEffectChain( + it->fxChannel ); + printf("adding %s to %d\n", effName.toAscii().constData(), + it->fxChannel ); + for( effectKeyList::iterator jt = effKeys.begin(); + jt != effKeys.end(); ++jt ) + { + if( QString( jt->desc->displayName ). + contains( effName ) || + ( jt->desc->sub_plugin_features != NULL && + jt->name.contains( effName ) ) ) + { + printf("instantiate %s\n", jt->desc->name ); + effect * e = effect::instantiate( + jt->desc->name, ec, &( *jt ) ); + ec->appendEffect( e ); + ec->setEnabled( true ); + break; + } + } + + progressDialog.setValue( ++cur_progress ); + qApp->processEvents(); + } + + + // process all playlist-items - for( playListItems::const_iterator it = m_plItems.begin(); - it != m_plItems.end(); ++it ) + for( QList::const_iterator it = + p.playListItems.begin(); + it != p.playListItems.end(); ++it ) { - int pat_num = ( ( *it ) >> 16 ) - 1; - if( pat_num > 100 ) + if( it->pattern > p.maxPatterns ) { continue; } - while( engine::getBBTrackContainer()->numOfBBs() <= pat_num ) + trackContentObject * tco = + bb_tracks[it->pattern]->createTCO( midiTime() ); + tco->movePosition( it->position ); + if( it->length != DefaultTicksPerTact ) { - track::create( track::BBTrack, engine::getSong() ); - qApp->processEvents( QEventLoop::AllEvents, 100 ); + tco->changeLength( it->length ); } - - bbTrack * bbt = bbTrack::findBBTrack( pat_num ); - trackContentObject * tco = bbt->addTCO( bbt->createTCO( 0 ) ); - tco->movePosition( midiTime( ( ( *it ) & 0xffff ) * - DefaultTicksPerTact ) ); } - if( project_cur_pat < engine::getBBTrackContainer()->numOfBBs() ) + + + // set current pattern + if( p.activeEditPattern < engine::getBBTrackContainer()->numOfBBs() ) { - engine::getBBTrackContainer()->setCurrentBB( project_cur_pat ); + engine::getBBTrackContainer()->setCurrentBB( + p.activeEditPattern ); } + // restore journalling settings engine::getProjectJournal()->setJournalling( is_journ ); - return( TRUE ); + + return true; } -bool flpImport::processPluginParams( const flPlugins _plugin, - const char * _data, - const int _data_len, instrument * _i ) +void flpImport::processPluginParams( FL_Channel * _ch ) { - printf( "plugin params for plugin %d (%d bytes): ", _plugin, - _data_len ); - dump_mem( _data, _data_len ); - switch( _plugin ) + printf( "plugin params for plugin %d (%d bytes): ", _ch->pluginType, + _ch->pluginSettingsLength ); + dump_mem( _ch->pluginSettings, _ch->pluginSettingsLength ); + switch( _ch->pluginType ) { - case FL_Plugin_3x_Osc: + case FL_Plugin::Sampler: // AudioFileProcessor loaded + { + QDomDocument dd; + QDomElement de = dd.createElement( + _ch->instrumentPlugin->nodeName() ); + de.setAttribute( "reversed", _ch->sampleReversed ); + de.setAttribute( "amp", _ch->sampleAmp ); + de.setAttribute( "looped", _ch->sampleUseLoopPoints ); + de.setAttribute( "sframe", 0 ); + de.setAttribute( "eframe", 1 ); + de.setAttribute( "src", _ch->sampleFileName ); + _ch->instrumentPlugin->restoreState( de ); + break; + } + + case FL_Plugin::TS404: // LB302 loaded + break; + + case FL_Plugin::Fruity_3x_Osc: // TripleOscillator loaded { const oscillator::WaveShapes mapped_3xOsc_Shapes[] = { @@ -877,16 +1823,19 @@ bool flpImport::processPluginParams( const flPlugins _plugin, } ; QDomDocument dd; - QDomElement de = dd.createElement( _i->nodeName() ); + QDomElement de = dd.createElement( + _ch->instrumentPlugin->nodeName() ); de.setAttribute( "modalgo1", oscillator::SignalMix ); de.setAttribute( "modalgo2", oscillator::SignalMix ); - for( Uint8 i = 0; i < 3; ++i ) + int ws = oscillator::UserDefinedWave; + for( int i = 0; i < 3; ++i ) { - const Sint32 * d = (const Sint32 *)( _data + - i * 28 ); + const Sint32 * d = (const Sint32 *) + ( _ch->pluginSettings + i * 28 ); QString is = QString::number( i ); de.setAttribute( "vol" + is, - QString::number( d[0] * 100 / 128 ) ); + QString::number( d[0] * 100 / + ( 3 * 128 ) ) ); de.setAttribute( "pan" + is, QString::number( d[1] ) ); de.setAttribute( "coarse" + is, @@ -897,28 +1846,39 @@ bool flpImport::processPluginParams( const flPlugins _plugin, QString::number( d[4] + d[6] / 2 ) ); de.setAttribute( "stphdetun" + is, QString::number( d[5] ) ); + const int s = mapped_3xOsc_Shapes[d[2]]; de.setAttribute( "wavetype" + is, - QString::number( - mapped_3xOsc_Shapes[d[2]] ) ); + QString::number( s ) ); + if( s != oscillator::UserDefinedWave ) + { + ws = s; + } } - de.setAttribute( "vol0", QString::number( 100 ) ); + if( ws == oscillator::UserDefinedWave ) + { + de.setAttribute( "wavetype0", + oscillator::SawWave ); + } + de.setAttribute( "vol0", QString::number( 100/2 ) ); // now apply the prepared plugin-state - _i->restoreState( de ); + _ch->instrumentPlugin->restoreState( de ); break; } - case FL_Plugin_Plucked: - { + case FL_Plugin::Layer: + // nothing to do + break; + + case FL_Plugin::Plucked: // Vibed loaded // TODO: setup vibed-instrument break; - } + case FL_Plugin::UnknownPlugin: default: printf( "handling of plugin params not implemented " "for current plugin\n" ); break; } - return( TRUE ); } @@ -930,23 +1890,8 @@ extern "C" // neccessary for getting instance out of shared lib plugin * PLUGIN_EXPORT lmms_plugin_main( model *, void * _data ) { - return( new flpImport( static_cast( _data ) ) ); + return new flpImport( static_cast( _data ) ); } - -// include unrtf-source -#include "attr.c" -#include "convert.c" -#include "error.c" -#include "hash.c" -#include "html.c" -#include "malloc.c" -#include "output.c" -#include "parse.c" -#include "util.c" -#include "word.c" - } - -#undef setValue diff --git a/plugins/flp_import/flp_import.h b/plugins/flp_import/flp_import.h index fabc3a13f..b266df8a1 100644 --- a/plugins/flp_import/flp_import.h +++ b/plugins/flp_import/flp_import.h @@ -34,134 +34,9 @@ #include "note.h" -enum flpEvents -{ - // BYTE EVENTS - FLP_Byte = 0, - FLP_Enabled = 0, - FLP_NoteOn = 1, //+pos (byte) - FLP_Vol = 2, - FLP_Pan = 3, - FLP_MIDIChan = 4, - FLP_MIDINote = 5, - FLP_MIDIPatch = 6, - FLP_MIDIBank = 7, - FLP_LoopActive = 9, - FLP_ShowInfo = 10, - FLP_Shuffle = 11, - FLP_MainVol = 12, - FLP_Stretch = 13, // old byte version - FLP_Pitchable = 14, - FLP_Zipped = 15, - FLP_Delay_Flags = 16, - FLP_PatLength = 17, - FLP_BlockLength = 18, - FLP_UseLoopPoints = 19, - FLP_LoopType = 20, - FLP_ChanType = 21, - FLP_MixSliceNum = 22, - - // WORD EVENTS - FLP_Word = 64, - FLP_NewChan = FLP_Word, - FLP_NewPat = FLP_Word + 1, //+PatNum (word) - FLP_Tempo = FLP_Word + 2, - FLP_CurrentPatNum = FLP_Word + 3, - FLP_PatData = FLP_Word + 4, - FLP_FX = FLP_Word + 5, - FLP_Fade_Stereo = FLP_Word + 6, - FLP_CutOff = FLP_Word + 7, - FLP_DotVol = FLP_Word + 8, - FLP_DotPan = FLP_Word + 9, - FLP_PreAmp = FLP_Word + 10, - FLP_Decay = FLP_Word + 11, - FLP_Attack = FLP_Word + 12, - FLP_DotNote = FLP_Word + 13, - FLP_DotPitch = FLP_Word + 14, - FLP_DotMix = FLP_Word + 15, - FLP_MainPitch = FLP_Word + 16, - FLP_RandChan = FLP_Word + 17, - FLP_MixChan = FLP_Word + 18, - FLP_Resonance = FLP_Word + 19, - FLP_LoopBar = FLP_Word + 20, - FLP_StDel = FLP_Word + 21, - FLP_FX3 = FLP_Word + 22, - FLP_DotReso = FLP_Word + 23, - FLP_DotCutOff = FLP_Word + 24, - FLP_ShiftDelay = FLP_Word + 25, - FLP_LoopEndBar = FLP_Word + 26, - FLP_Dot = FLP_Word + 27, - FLP_DotShift = FLP_Word + 28, - - // DWORD EVENTS - FLP_Int = 128, - FLP_Color = FLP_Int, - FLP_PlayListItem = FLP_Int + 1, //+Pos (word) +PatNum (word) - FLP_Echo = FLP_Int + 2, - FLP_FXSine = FLP_Int + 3, - FLP_CutCutBy = FLP_Int + 4, - FLP_WindowH = FLP_Int + 5, - FLP_MiddleNote = FLP_Int + 7, - FLP_Reserved = FLP_Int + 8, // may contain an invalid version info - FLP_MainResoCutOff = FLP_Int + 9, - FLP_DelayReso = FLP_Int + 10, - FLP_Reverb = FLP_Int + 11, - FLP_IntStretch = FLP_Int + 12, - FLP_SSNote = FLP_Int + 13, - FLP_FineTune = FLP_Int + 14, - - // TEXT EVENTS - FLP_Undef = 192, //+Size (var length) - FLP_Text = FLP_Undef, //+Size (var length)+Text - // (Null Term. String) - FLP_Text_ChanName = FLP_Text, // name for the current channel - FLP_Text_PatName = FLP_Text + 1, // name for the current pattern - FLP_Text_Title = FLP_Text + 2, // title of the loop - FLP_Text_Comment = FLP_Text + 3, // old comments in text format. - // Not used anymore - FLP_Text_SampleFileName = FLP_Text + 4, // filename for the sample in - // the current channel, stored - // as relative path - FLP_Text_URL = FLP_Text + 5, - FLP_Text_CommentRTF = FLP_Text + 6, // new comments in Rich Text - // format - FLP_Version = FLP_Text + 7, - FLP_Text_PluginName = FLP_Text + 9, // plugin file name - // (without path) - - FLP_MIDICtrls = FLP_Text + 16, - FLP_Delay = FLP_Text + 17, - FLP_TS404Params = FLP_Text + 18, - FLP_DelayLine = FLP_Text + 19, - FLP_NewPlugin = FLP_Text + 20, - FLP_PluginParams = FLP_Text + 21, - FLP_ChanParams = FLP_Text + 23,// block of various channel - // params (can grow) - FLP_EnvLfoParams = FLP_Text + 26, - FLP_FilterParams = FLP_Text + 27, - FLP_PatternNotes = FLP_Text + 32, - FLP_StepData = FLP_Text + 33, - - FLP_CmdCount - -} ; - - -enum flPlugins -{ - FL_Plugin_3x_Osc, - FL_Plugin_Sampler, - FL_Plugin_Plucked, - FL_Plugin_SimSynth, - FL_Plugin_DX10, - FL_Plugin_Sytrus, - FL_Plugin_WASP, - FL_Plugin_Undef -} ; - class instrument; - +struct FL_Channel; class flpImport : public importFilter { @@ -178,8 +53,7 @@ public: private: virtual bool tryImport( trackContainer * _tc ); - bool processPluginParams( const flPlugins _plugin, const char * _data, - const int _data_len, instrument * _i ); + void processPluginParams( FL_Channel * _ch ); inline int readInt( int _bytes ) { @@ -226,15 +100,6 @@ private: } - typedef QList > patternNoteVector; - patternNoteVector m_notes; - - typedef QList stepVector; - stepVector m_steps; - - typedef QList playListItems; - playListItems m_plItems; - } ; diff --git a/plugins/flp_import/unrtf.cpp b/plugins/flp_import/unrtf.cpp new file mode 100644 index 000000000..b2376450b --- /dev/null +++ b/plugins/flp_import/unrtf.cpp @@ -0,0 +1,69 @@ +/* + * unrtf.cpp - integration of UnRTF + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "lmmsconfig.h" + +#include +#include + +extern "C" +{ + +// unrtf-stuff +#include "defs.h" +#include "main.h" +#include "html.h" +#include "word.h" +#include "hash.h" +#include "convert.h" +#include "attr.h" + + +int lineno = 0; +#define inline_mode 0 +#define debug_mode 0 +#define nopict_mode 1 +#define verbose_mode 0 +#define simple_mode 0 +#define no_remap_mode 0 + +QString outstring; +short numchar_table; +OutputPersonality * op = NULL; + + +// include unrtf-source +#include "attr.c" +#include "convert.c" +#include "error.c" +#include "hash.c" +#include "html.c" +#include "malloc.c" +#include "output.c" +#include "parse.c" +#include "util.c" +#include "word.c" + +} diff --git a/plugins/flp_import/unrtf/attr.c b/plugins/flp_import/unrtf/attr.c index 1da0a3e97..87094d87d 100644 --- a/plugins/flp_import/unrtf/attr.c +++ b/plugins/flp_import/unrtf/attr.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -33,6 +33,8 @@ * 22 Sep 01, tuorfa@yahoo.com: added comment blocks * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 16 Dec 07, daved@physiol.usyd.edu.au: fixed fore/background_begin error + * and updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H @@ -106,10 +108,10 @@ attr_express_begin (int attr, const char* param) { switch(attr) { case ATTR_BOLD: - outstring+=QString("%1").arg(op->bold_begin); + outstring+=QString().sprintf(op->bold_begin); break; case ATTR_ITALIC: - outstring+=QString("%1").arg(op->italic_begin); + outstring+=QString().sprintf(op->italic_begin); break; /* Various underlines, they all resolve to HTML's */ @@ -121,11 +123,11 @@ attr_express_begin (int attr, const char* param) { case ATTR_2DOT_DASH_UL: case ATTR_WORD_UL: case ATTR_UNDERLINE: - outstring+=QString("%1").arg(op->underline_begin); + outstring+=QString().sprintf(op->underline_begin); break; case ATTR_DOUBLE_UL: - outstring+=QString("%1").arg(op->dbl_underline_begin); + outstring+=QString().sprintf(op->dbl_underline_begin); break; case ATTR_FONTSIZE: @@ -133,48 +135,48 @@ attr_express_begin (int attr, const char* param) { break; case ATTR_FONTFACE: - outstring+=QString("%1").arg(op->font_begin,param); + outstring+=QString().sprintf(op->font_begin,param); break; case ATTR_FOREGROUND: - outstring+=QString("%1").arg(op->foreground_begin, param); + outstring+=QString().sprintf(op->foreground_begin, param); break; case ATTR_BACKGROUND: if (!simple_mode) - outstring+=QString("%1").arg(op->foreground_begin,param); + outstring+=QString().sprintf(op->background_begin,param); break; case ATTR_SUPER: - outstring+=QString("%1").arg(op->superscript_begin); + outstring+=QString().sprintf(op->superscript_begin); break; case ATTR_SUB: - outstring+=QString("%1").arg(op->subscript_begin); + outstring+=QString().sprintf(op->subscript_begin); break; case ATTR_STRIKE: - outstring+=QString("%1").arg(op->strikethru_begin); + outstring+=QString().sprintf(op->strikethru_begin); break; case ATTR_DBL_STRIKE: - outstring+=QString("%1").arg(op->dbl_strikethru_begin); + outstring+=QString().sprintf(op->dbl_strikethru_begin); break; case ATTR_EXPAND: - outstring+=QString("%1").arg(op->expand_begin, param); + outstring+=QString().sprintf(op->expand_begin, param); break; case ATTR_OUTLINE: - outstring+=QString("%1").arg(op->outline_begin); + outstring+=QString().sprintf(op->outline_begin); break; case ATTR_SHADOW: - outstring+=QString("%1").arg(op->shadow_begin); + outstring+=QString().sprintf(op->shadow_begin); break; case ATTR_EMBOSS: - outstring+=QString("%1").arg(op->emboss_begin); + outstring+=QString().sprintf(op->emboss_begin); break; case ATTR_ENGRAVE: - outstring+=QString("%1").arg(op->engrave_begin); + outstring+=QString().sprintf(op->engrave_begin); break; case ATTR_CAPS: @@ -187,7 +189,7 @@ attr_express_begin (int attr, const char* param) { simulate_smallcaps = TRUE; else { if (op->small_caps_begin) - outstring+=QString("%1").arg(op->small_caps_begin); + outstring+=QString().sprintf(op->small_caps_begin); } break; } @@ -207,10 +209,10 @@ attr_express_end (int attr, char *param) switch(attr) { case ATTR_BOLD: - outstring+=QString("%1").arg(op->bold_end); + outstring+=QString().sprintf(op->bold_end); break; case ATTR_ITALIC: - outstring+=QString("%1").arg(op->italic_end); + outstring+=QString().sprintf(op->italic_end); break; /* Various underlines, they all resolve to HTML's */ @@ -222,11 +224,11 @@ attr_express_end (int attr, char *param) case ATTR_2DOT_DASH_UL: case ATTR_WORD_UL: case ATTR_UNDERLINE: - outstring+=QString("%1").arg(op->underline_end); + outstring+=QString().sprintf(op->underline_end); break; case ATTR_DOUBLE_UL: - outstring+=QString("%1").arg(op->dbl_underline_end); + outstring+=QString().sprintf(op->dbl_underline_end); break; case ATTR_FONTSIZE: @@ -234,47 +236,47 @@ attr_express_end (int attr, char *param) break; case ATTR_FONTFACE: - outstring+=QString("%1").arg(op->font_end); + outstring+=QString().sprintf(op->font_end); break; case ATTR_FOREGROUND: - outstring+=QString("%1").arg(op->foreground_end); + outstring+=QString().sprintf(op->foreground_end); break; case ATTR_BACKGROUND: if (!simple_mode) - outstring+=QString("%1").arg(op->background_end); + outstring+=QString().sprintf(op->background_end); break; case ATTR_SUPER: - outstring+=QString("%1").arg(op->superscript_end); + outstring+=QString().sprintf(op->superscript_end); break; case ATTR_SUB: - outstring+=QString("%1").arg(op->subscript_end); + outstring+=QString().sprintf(op->subscript_end); break; case ATTR_STRIKE: - outstring+=QString("%1").arg(op->strikethru_end); + outstring+=QString().sprintf(op->strikethru_end); break; case ATTR_DBL_STRIKE: - outstring+=QString("%1").arg(op->dbl_strikethru_end); + outstring+=QString().sprintf(op->dbl_strikethru_end); break; case ATTR_OUTLINE: - outstring+=QString("%1").arg(op->outline_end); + outstring+=QString().sprintf(op->outline_end); break; case ATTR_SHADOW: - outstring+=QString("%1").arg(op->shadow_end); + outstring+=QString().sprintf(op->shadow_end); break; case ATTR_EMBOSS: - outstring+=QString("%1").arg(op->emboss_end); + outstring+=QString().sprintf(op->emboss_end); break; case ATTR_ENGRAVE: - outstring+=QString("%1").arg(op->engrave_end); + outstring+=QString().sprintf(op->engrave_end); break; case ATTR_EXPAND: - outstring+=QString("%1").arg(op->expand_end); + outstring+=QString().sprintf(op->expand_end); break; case ATTR_CAPS: @@ -287,7 +289,7 @@ attr_express_end (int attr, char *param) simulate_smallcaps = FALSE; else { if (op->small_caps_end) - outstring+=QString("%1").arg(op->small_caps_end); + outstring+=QString().sprintf(op->small_caps_end); } break; } @@ -331,6 +333,42 @@ attr_push(int attr, const char* param) attr_express_begin(attr, param); } +#if 1 /* daved 0.20.2 */ + +/*======================================================================== + * Name: attr_get_param + * Purpose: Reads an attribute from the current attribute stack. + * Args: Attribute number + * Returns: string. + *=======================================================================*/ + +char * +attr_get_param(int attr) +{ + int i; + AttrStack *stack = stack_of_stacks_top; + if (!stack) { + warning_handler("No stack to get attribute from"); + return NULL; + } + + i=stack->tos; + while (i>=0) + { + if(stack->attr_stack [i] == attr) + { + if(stack->attr_stack_params [i] != NULL) + return stack->attr_stack_params [i]; + else + return NULL; + } + i--; + } + return NULL; +} + +#endif + /*======================================================================== * Name: attrstack_copy_all diff --git a/plugins/flp_import/unrtf/attr.h b/plugins/flp_import/unrtf/attr.h index 04a1bba3c..04c6f3fb9 100644 --- a/plugins/flp_import/unrtf/attr.h +++ b/plugins/flp_import/unrtf/attr.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -32,11 +32,13 @@ * 18 Sep 01, tuorfa@yahoo.com: updates for AttrStack paradigm * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifndef _ATTR #define _ATTR + enum { ATTR_NONE=0, ATTR_BOLD, ATTR_ITALIC, @@ -90,6 +92,13 @@ extern void attr_pop_all(); extern void attr_pop_dump(); +#if 1 /* daved 0.20.2 */ + +char * attr_get_param(int attr); + +#endif + + #endif diff --git a/plugins/flp_import/unrtf/convert.c b/plugins/flp_import/unrtf/convert.c index c3538b4e0..87892a3cf 100644 --- a/plugins/flp_import/unrtf/convert.c +++ b/plugins/flp_import/unrtf/convert.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -58,8 +58,13 @@ * 03 Mar 06, daved@physiol.usyd.edu.au: fixed creation date spelling and added support for accented characters in titles from Laurent Monin - # 09 Mar 06, daved@physiol.usyd.edu.au: don't print null post_trans + * 09 Mar 06, daved@physiol.usyd.edu.au: don't print null post_trans + * 18 Jun 06, daved@physiol.usyd.edu.au: fixed some incorrect comment_end + * 18 Jun 06, frolovs@internet2.ru: codepage support * 31 Oct 07, jasp00@users.sourceforge.net: fixed several warnings + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 + * 17 Dec 07, daved@physiol.usyd.edu.au: Italian month name spelling corrections + # from David Santinoli *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H @@ -94,16 +99,466 @@ #include "attr.h" +static CodepageInfo codepages[14] = +{ +/*-- cp850 --*/ +{ + 850, + { + /* 0x80 */ + 0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, + 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5, + /* 0x90 */ + 0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, + 0x00ff, 0x00d6, 0x00dc, 0x00f8, 0x00a3, 0x00d8, 0x00d7, 0x0192, + /* 0xa0 */ + 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, + 0x00bf, 0x00ae, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb, + /* 0xb0 */ + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00c1, 0x00c2, 0x00c0, + 0x00a9, 0x2563, 0x2551, 0x2557, 0x255d, 0x00a2, 0x00a5, 0x2510, + /* 0xc0 */ + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x00e3, 0x00c3, + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x00a4, + /* 0xd0 */ + 0x00f0, 0x00d0, 0x00ca, 0x00cb, 0x00c8, 0x0131, 0x00cd, 0x00ce, + 0x00cf, 0x2518, 0x250c, 0x2588, 0x2584, 0x00a6, 0x00cc, 0x2580, + /* 0xe0 */ + 0x00d3, 0x00df, 0x00d4, 0x00d2, 0x00f5, 0x00d5, 0x00b5, 0x00fe, + 0x00de, 0x00da, 0x00db, 0x00d9, 0x00fd, 0x00dd, 0x00af, 0x00b4, + /* 0xf0 */ + 0x00ad, 0x00b1, 0x2017, 0x00be, 0x00b6, 0x00a7, 0x00f7, 0x00b8, + 0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2, 0x25a0, 0x00a0, + } +}, +/*-- cp866 --*/ +{ + 866, + { + /* 0x80 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x90 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xa0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xb0 */ + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, + 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, + /* 0xc0 */ + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, + /* 0xd0 */ + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, + 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, + /* 0xe0 */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, + /* 0xf0 */ + 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040e, 0x045e, + 0x00b0, 0x2219, 0x00b7, 0x221a, 0x2116, 0x00a4, 0x25a0, 0x00a0, + } +}, +/*-- cp874 --*/ +{ + 874, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2026, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa0 */ + 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + /* 0xb0 */ + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + /* 0xc0 */ + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + /* 0xd0 */ + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, + /* 0xe0 */ + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, + /* 0xf0 */ + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + } +}, +/*-- cp1133 --*/ +{ + 1133, + { + /* 0x80 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x90 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xa0 */ + 0x00a0, 0x0e81, 0x0e82, 0x0e84, 0x0e87, 0x0e88, 0x0eaa, 0x0e8a, + 0x0e8d, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0x0e99, 0x0e9a, 0x0e9b, + /* 0xb0 */ + 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 0x0ea1, 0x0ea2, 0x0ea3, 0x0ea5, + 0x0ea7, 0x0eab, 0x0ead, 0x0eae, 0xfffd, 0xfffd, 0xfffd, 0x0eaf, + /* 0xc0 */ + 0x0eb0, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, + 0x0eb9, 0x0ebc, 0x0eb1, 0x0ebb, 0x0ebd, 0xfffd, 0xfffd, 0xfffd, + /* 0xd0 */ + 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0x0ec8, 0x0ec9, 0x0eca, + 0x0ecb, 0x0ecc, 0x0ecd, 0x0ec6, 0xfffd, 0x0edc, 0x0edd, 0x20ad, + /* 0xe0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xf0 */ + 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, + 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x00a2, 0x00ac, 0x00a6, 0xfffd, + } +}, +/*-- cp1250 --*/ +{ + 1250, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0xfffd, 0x201e, 0x2026, 0x2020, 0x2021, + 0xfffd, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xfffd, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, + /* 0xa0 */ + 0x00a0, 0x02c7, 0x02d8, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c, + /* 0xc0 */ + 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, + /* 0xd0 */ + 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, + 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, + /* 0xe0 */ + 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, + /* 0xf0 */ + 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, + 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, + } +}, +/*-- cp1251 --*/ +{ + 1251, + { + /* 0x80 */ + 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, + 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, + /* 0x90 */ + 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xfffd, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, + /* 0xa0 */ + 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, + 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, + 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, + /* 0xc0 */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + /* 0xd0 */ + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + /* 0xe0 */ + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + /* 0xf0 */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, + } +}, +/*-- cp1252 --*/ +{ + 1252, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfffd, 0x017d, 0xfffd, + /* 0x90 */ +#if 1 +/* daved - don't process 93 & 94 as we want entities */ + 0xfffd, 0x2018, 0x2019, 0, 0, 0x2022, 0x2013, 0x2014, +#else + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, +#endif + 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xfffd, 0x017e, 0x0178, +#if 1 + /* 0xa0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xb0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xc0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xd0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xe0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xf0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +#else /* daved experimenting */ + /* 0xa0 */ + 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, + /* 0xb0 */ + 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, + /* 0xc0 */ + 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, + /* 0xd0 */ + 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, + /* 0xe0 */ + 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, + /* 0xf0 */ + 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, +#endif + } +}, +/*-- cp1253 --*/ +{ + 1253, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0xfffd, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xfffd, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa0 */ + 0x00a0, 0x0385, 0x0386, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0xfffd, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x2015, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x00b5, 0x00b6, 0x00b7, + 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, + /* 0xc0 */ + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + /* 0xd0 */ + 0x03a0, 0x03a1, 0xfffd, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, + /* 0xe0 */ + 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + /* 0xf0 */ + 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xfffd, + } +}, +/*-- 1254 --*/ +{ + 1254, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfffd, 0xfffd, 0xfffd, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xfffd, 0xfffd, 0x0178, + /* 0xa0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xb0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xc0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xd0 */ + 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, + /* 0xe0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xf0 */ + 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, + } +}, +/*-- cp1255 --*/ +{ + 1255, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x02dc, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa0 */ + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20aa, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + /* 0xc0 */ + 0x05b0, 0x05b1, 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, + 0x05b8, 0x05b9, 0xfffd, 0x05bb, 0x05bc, 0x05bd, 0x05be, 0x05bf, + /* 0xd0 */ + 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f0, 0x05f1, 0x05f2, 0x05f3, + 0x05f4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xe0 */ + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, + /* 0xf0 */ + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, + 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, + } +}, +/*-- cp1256 --*/ +{ + 1256, + { + /* 0x80 */ + 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, + /* 0x90 */ + 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, + /* 0xa0 */ + 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, + /* 0xc0 */ + 0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, + /* 0xd0 */ + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, + 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, + /* 0xe0 */ + 0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, + 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2, + } +}, +{ + 1257, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0xfffd, 0x201e, 0x2026, 0x2020, 0x2021, + 0xfffd, 0x2030, 0xfffd, 0x2039, 0xfffd, 0x00a8, 0x02c7, 0x00b8, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xfffd, 0x2122, 0xfffd, 0x203a, 0xfffd, 0x00af, 0x02db, 0xfffd, + /* 0xa0 */ + 0x00a0, 0xfffd, 0x00a2, 0x00a3, 0x00a4, 0xfffd, 0x00a6, 0x00a7, + 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, + /* 0xc0 */ + 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, + 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, + /* 0xd0 */ + 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, + 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, + /* 0xe0 */ + 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, + 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, + /* 0xf0 */ + 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, + 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x02d9, + } +}, +{ + 1258, + { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0xfffd, 0x2039, 0x0152, 0xfffd, 0xfffd, 0xfffd, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x02dc, 0x2122, 0xfffd, 0x203a, 0x0153, 0xfffd, 0xfffd, 0x0178, + /* 0xa0 */ + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + /* 0xc0 */ + 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x0300, 0x00cd, 0x00ce, 0x00cf, + /* 0xd0 */ + 0x0110, 0x00d1, 0x0309, 0x00d3, 0x00d4, 0x01a0, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x01af, 0x0303, 0x00df, + /* 0xe0 */ + 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0301, 0x00ed, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x0111, 0x00f1, 0x0323, 0x00f3, 0x00f4, 0x01a1, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x01b0, 0x20ab, 0x00ff, + } +}, +/*-- null --*/ +{ + 0, + { + /* 0x80 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x90 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xa0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xb0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xc0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xd0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xe0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xf0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + } +}, +}; + + //extern int nopict_mode; /* #define BINARY_ATTRS */ -QString outstring; +extern QString outstring; static int charset_type=CHARSET_ANSI; +static CodepageInfo * charset_codepage; /* Nested tables aren't supported. @@ -195,8 +650,8 @@ starting_body () { if (!have_printed_body) { if (!inline_mode) { - outstring+=QString("%1").arg(op->header_end); - outstring+=QString("%1").arg(op->body_begin); + outstring+=QString().sprintf(op->header_end); + outstring+=QString().sprintf(op->body_begin); } within_header = FALSE; have_printed_body = TRUE; @@ -219,8 +674,8 @@ static const char *month_strings[12]= { "Octobre","Novembre","Decembre" #endif #ifdef ITALIANO - "Ianuario","Febbraio","Marzo","Aprile","Maggio","Iuno", - "Luglio","Agusto","Settembre","Ottobre","Novembre","Dicembre" + "Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno", + "Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre" #endif #ifdef ESPANOL /* amaral - 0.19.2 */ "Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto", @@ -344,7 +799,7 @@ process_font_table (Word *w) tmp = word_string (w2); if (tmp && tmp[0] != '\\') { if (strlen(tmp) + strlen(name) > BUFSIZ - 1) { - printf("Invalid font table entry\n"); + outstring+=QString().sprintf("Invalid font table entry\n"); name[0] = 0; } else @@ -365,20 +820,20 @@ process_font_table (Word *w) w=w->next; } - printf("%s",op->comment_begin); - printf("font table contains %d fonts total",total_fonts); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("font table contains %d fonts total",total_fonts); + outstring+=QString().sprintf("%s",op->comment_end); if (debug_mode) { int i; - printf("%s",op->comment_begin); - printf("font table dump: \n"); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("font table dump: \n"); for (i=0; icomment_end); + outstring+=QString().sprintf("%s",op->comment_end); } } @@ -402,9 +857,9 @@ process_index_entry (Word *w) char *str = word_string (w2); if (debug_mode && str) { - printf("%s",op->comment_begin); - printf("index entry word: %s ", str); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("index entry word: %s ", str); + outstring+=QString().sprintf("%s",op->comment_end); } } w=w->next; @@ -431,11 +886,11 @@ process_toc_entry (Word *w, int include_page_num) char *str = word_string (w2); if (debug_mode && str) { - printf("%s",op->comment_begin); + outstring+=QString().sprintf("%s",op->comment_begin); printf("toc %s entry word: %s ", include_page_num ? "page#":"no page#", str); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); } } w=w->next; @@ -457,7 +912,7 @@ process_info_group (Word *w) #if 1 /* amaral - 0.19.2 */ /* CHECK_PARAM_NOT_NULL(w); */ - if (!w) printf("AUTHOR'S COMMENT: \\info command is null!\n"); + if (!w) outstring+=QString().sprintf("AUTHOR'S COMMENT: \\info command is null!\n"); #endif @@ -471,7 +926,7 @@ process_info_group (Word *w) if (!inline_mode) { if (!strcmp("\\title", s)) { - outstring+=QString("%1").arg(op->document_title_begin); + outstring+=QString().sprintf(op->document_title_begin); w2=child->next; while (w2) { char *s2 = word_string(w2); @@ -482,7 +937,7 @@ process_info_group (Word *w) #if 1 /* daved 0.19.6 */ print_with_special_exprs (s2); #else - outstring+=QString("%1").arg("%s", s2); + outstring+=QString().sprintf("%s", s2); #endif #if 1 /* daved 0.20.0 */ } @@ -493,21 +948,21 @@ process_info_group (Word *w) int ch = h2toi (&s2[2]); const char *s3; - s3 = op_translate_char (op, charset_type, ch, numchar_table); + s3 = op_translate_char (op, charset_type, charset_codepage, ch, numchar_table); if (!s3 || !*s3) { - printf("%s",op->comment_begin); - printf("char 0x%02x",ch); - printf("%s",op->comment_end); + outstring+=QString().sprintf(op->comment_begin); + outstring+=QString().sprintf("char 0x%02x",ch); + outstring+=QString().sprintf(op->comment_end); } else { if (op->word_begin) - outstring+=QString("%1").arg(op->word_begin); - outstring+=QString("%1").arg("%s", s3); + outstring+=QString().sprintf(op->word_begin); + outstring+=QString().sprintf("%s", s3); if (op->word_end) - outstring+=QString("%1").arg(op->word_end); + outstring+=QString().sprintf(op->word_end); } } } @@ -515,80 +970,80 @@ process_info_group (Word *w) #endif w2 = w2->next; } - outstring+=QString("%1").arg(op->document_title_end); + outstring+=QString().sprintf(op->document_title_end); } else if (!strcmp("\\keywords", s)) { - outstring+=QString("%1").arg(op->document_keywords_begin); + outstring+=QString().sprintf(op->document_keywords_begin); w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2[0] != '\\') - outstring+=QString("%1").arg("%s,", s2); + outstring+=QString().sprintf("%s,", s2); w2 = w2->next; } - outstring+=QString("%1").arg(op->document_keywords_end); + outstring+=QString().sprintf(op->document_keywords_end); } else if (!strcmp("\\author", s)) { - outstring+=QString("%1").arg(op->document_author_begin); + outstring+=QString().sprintf(op->document_author_begin); w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2[0] != '\\') - outstring+=QString("%1").arg("%s", s2); + outstring+=QString().sprintf("%s", s2); w2 = w2->next; } - outstring+=QString("%1").arg(op->document_author_end); + outstring+=QString().sprintf(op->document_author_end); } else if (!strcmp("\\comment", s)) { - printf("%s",op->comment_begin); - printf("comments: "); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("comments: "); w2=child->next; while (w2) { char *s2 = word_string(w2); if (s2[0] != '\\') - printf("%s", s2); + outstring+=QString().sprintf("%s", s2); w2 = w2->next; } - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); } else if (!strncmp("\\nofpages", s, 9)) { - printf("%s",op->comment_begin); - printf("total pages: %s",&s[9]); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("total pages: %s",&s[9]); + outstring+=QString().sprintf("%s",op->comment_end); } else if (!strncmp("\\nofwords", s, 9)) { - printf("%s",op->comment_begin); - printf("total words: %s",&s[9]); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("total words: %s",&s[9]); + outstring+=QString().sprintf("%s",op->comment_end); } else if (!strncmp("\\nofchars", s, 9) && isdigit(s[9])) { - printf("%s",op->comment_begin); - printf("total chars: %s",&s[9]); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("total chars: %s",&s[9]); + outstring+=QString().sprintf("%s",op->comment_end); } else if (!strcmp("\\creatim", s)) { - printf("%s",op->comment_begin); - printf("creation date: "); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("creation date: "); if (child->next) word_dump_date (child->next); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); } else if (!strcmp("\\printim", s)) { - printf("%s",op->comment_begin); - printf("last printed: "); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("last printed: "); if (child->next) word_dump_date (child->next); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); } else if (!strcmp("\\buptim", s)) { - printf("%s",op->comment_begin); - printf("last backup: "); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("last backup: "); if (child->next) word_dump_date (child->next); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); } else if (!strcmp("\\revtim", s)) { - printf("%s",op->comment_begin); - printf("revision date: "); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("revision date: "); if (child->next) word_dump_date (child->next); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); } } @@ -598,8 +1053,8 @@ process_info_group (Word *w) if (!strcmp("\\hlinkbase", s)) { char *linkstr = NULL; - printf("%s",op->comment_begin); - printf("hyperlink base: "); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("hyperlink base: "); if (child->next) { Word *nextword = child->next; @@ -608,10 +1063,10 @@ process_info_group (Word *w) } if (linkstr) - printf("%s", linkstr); + outstring+=QString().sprintf("%s", linkstr); else - printf("(none)"); - printf("%s",op->comment_end); + outstring+=QString().sprintf("(none)"); + outstring+=QString().sprintf("%s",op->comment_end); /* Store the pointer, it will remain good. */ hyperlink_base = linkstr; @@ -658,9 +1113,9 @@ process_color_table (Word *w) char *s = word_string (w); #if 0 - printf("%s",op->comment_begin); - printf("found this color table word: %s", word_string(w)); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("found this color table word: %s", word_string(w)); + outstring+=QString().sprintf("%s",op->comment_end); #endif if (!strncmp("\\red",s,4)) { @@ -685,10 +1140,10 @@ process_color_table (Word *w) color_table[total_colors].g = g; color_table[total_colors++].b = b; if (debug_mode) { - printf("%s",op->comment_begin); + outstring+=QString().sprintf("%s",op->comment_begin); printf("storing color entry %d: %02x%02x%02x", total_colors-1, r,g,b); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); } r=g=b=0; } @@ -697,9 +1152,9 @@ process_color_table (Word *w) } if (debug_mode) { - printf("%s",op->comment_begin); - printf("color table had %d entries -->\n", total_colors); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("color table had %d entries -->\n", total_colors); + outstring+=QString().sprintf("%s",op->comment_end); } } @@ -837,7 +1292,7 @@ cmd_field (Word *w, int align, char has_param, int num) { { const char * string; if ((string = op->symbol_translation_table[char_num - op->symbol_first_char]) != 0) - outstring+=QString("%1").arg("%s", string); + outstring+=QString().sprintf("%s", string); } } } @@ -857,9 +1312,9 @@ cmd_field (Word *w, int align, char has_param, int num) { w4=w4->next; if (w4) { s4=word_string(w4); - outstring+=QString("%1").arg(op->hyperlink_begin); - outstring+=QString("%1").arg("%s", s4); - outstring+=QString("%1").arg(op->hyperlink_end); + outstring+=QString().sprintf(op->hyperlink_begin); + outstring+=QString().sprintf("%s", s4); + outstring+=QString().sprintf(op->hyperlink_end); return TRUE; } @@ -900,15 +1355,21 @@ cmd_f (Word *w, int align, char has_param, int num) { numchar_table = FONTROMAN_TABLE; #endif if (!name) { - printf("%s",op->comment_begin); - printf("invalid font number %d",num); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("invalid font number %d",num); + outstring+=QString().sprintf("%s",op->comment_end); } else { attr_push(ATTR_FONTFACE,name); #if 1 /* daved - 0.19.6 */ if (strstr(name,"Symbol") != NULL) numchar_table=FONTSYMBOL_TABLE; #endif +#if 1 /* daved - 0.20.3 */ + else if (strstr(name,"Greek") != NULL) + numchar_table=FONTGREEK_TABLE; +#endif + if(0) + outstring+=QString().sprintf("", numchar_table); } return FALSE; @@ -962,10 +1423,10 @@ cmd_tab (Word *w, int align, char has_param, int param) int need= 8-(total_chars_this_line%8); total_chars_this_line += need; while(need>0) { - outstring+=QString("%1").arg(op->forced_space); + outstring+=QString().sprintf(op->forced_space); need--; } - outstring+=QString("%1").arg("\n"); + outstring+=QString().sprintf("\n"); return FALSE; } @@ -1182,7 +1643,7 @@ cmd_scaps (Word *w, int align, char has_param, int param) { static int cmd_bullet (Word *w, int align, char has_param, int param) { if (op->chars.bullet) { - outstring+=QString("%1").arg(op->chars.bullet); + outstring+=QString().sprintf(op->chars.bullet); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1197,7 +1658,7 @@ cmd_bullet (Word *w, int align, char has_param, int param) { static int cmd_ldblquote (Word *w, int align, char has_param, int param) { if (op->chars.left_dbl_quote) { - outstring+=QString("%1").arg(op->chars.left_dbl_quote); + outstring+=QString().sprintf(op->chars.left_dbl_quote); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1214,7 +1675,7 @@ cmd_ldblquote (Word *w, int align, char has_param, int param) { static int cmd_rdblquote (Word *w, int align, char has_param, int param) { if (op->chars.right_dbl_quote) { - outstring+=QString("%1").arg(op->chars.right_dbl_quote); + outstring+=QString().sprintf(op->chars.right_dbl_quote); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1230,7 +1691,7 @@ cmd_rdblquote (Word *w, int align, char has_param, int param) { static int cmd_lquote (Word *w, int align, char has_param, int param) { if (op->chars.left_quote) { - outstring+=QString("%1").arg(op->chars.left_quote); + outstring+=QString().sprintf(op->chars.left_quote); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1247,7 +1708,7 @@ cmd_lquote (Word *w, int align, char has_param, int param) { static int cmd_nonbreaking_space (Word *w, int align, char has_param, int param) { if (op->chars.nonbreaking_space) { - outstring+=QString("%1").arg(op->chars.nonbreaking_space); + outstring+=QString().sprintf(op->chars.nonbreaking_space); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1264,7 +1725,7 @@ cmd_nonbreaking_space (Word *w, int align, char has_param, int param) { static int cmd_nonbreaking_hyphen (Word *w, int align, char has_param, int param) { if (op->chars.nonbreaking_hyphen) { - outstring+=QString("%1").arg(op->chars.nonbreaking_hyphen); + outstring+=QString().sprintf(op->chars.nonbreaking_hyphen); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1281,7 +1742,7 @@ cmd_nonbreaking_hyphen (Word *w, int align, char has_param, int param) { static int cmd_optional_hyphen (Word *w, int align, char has_param, int param) { if (op->chars.optional_hyphen) { - outstring+=QString("%1").arg(op->chars.optional_hyphen); + outstring+=QString().sprintf(op->chars.optional_hyphen); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1297,7 +1758,7 @@ cmd_optional_hyphen (Word *w, int align, char has_param, int param) { static int cmd_emdash (Word *w, int align, char has_param, int param) { if (op->chars.emdash) { - outstring+=QString("%1").arg(op->chars.emdash); + outstring+=QString().sprintf(op->chars.emdash); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1314,7 +1775,7 @@ cmd_emdash (Word *w, int align, char has_param, int param) { static int cmd_endash (Word *w, int align, char has_param, int param) { if (op->chars.endash) { - outstring+=QString("%1").arg(op->chars.endash); + outstring+=QString().sprintf(op->chars.endash); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1331,7 +1792,7 @@ cmd_endash (Word *w, int align, char has_param, int param) { static int cmd_rquote (Word *w, int align, char has_param, int param) { if (op->chars.right_quote) { - outstring+=QString("%1").arg(op->chars.right_quote); + outstring+=QString().sprintf(op->chars.right_quote); ++total_chars_this_line; /* \tab */ } return FALSE; @@ -1347,7 +1808,7 @@ cmd_rquote (Word *w, int align, char has_param, int param) { static int cmd_par (Word *w, int align, char has_param, int param) { if (op->line_break) { - outstring+=QString("%1").arg(op->line_break); + outstring+=QString().sprintf(op->line_break); total_chars_this_line = 0; /* \tab */ } return FALSE; @@ -1364,7 +1825,7 @@ cmd_par (Word *w, int align, char has_param, int param) { static int cmd_line (Word *w, int align, char has_param, int param) { if (op->line_break) { - outstring+=QString("%1").arg(op->line_break); + outstring+=QString().sprintf(op->line_break); total_chars_this_line = 0; /* \tab */ } return FALSE; @@ -1380,7 +1841,7 @@ cmd_line (Word *w, int align, char has_param, int param) { static int cmd_page (Word *w, int align, char has_param, int param) { if (op->page_break) { - outstring+=QString("%1").arg(op->page_break); + outstring+=QString().sprintf(op->page_break); total_chars_this_line = 0; /* \tab */ } return FALSE; @@ -1665,8 +2126,8 @@ static int cmd_u (Word *w, int align, char has_param, int param) { char *str; if (has_param == TRUE) { - fprintf(stderr,"param is %d (%x)\n", param, - param); + fprintf(stderr,"param is %d (x%x) (0%o)\n", param, + param, param); } if (w->hash_index) { @@ -1683,9 +2144,9 @@ static int cmd_u (Word *w, int align, char has_param, int param) { { const char *string; if ((string = op->unisymbol1_translation_table[param - op->unisymbol1_first_char]) != 0) - outstring+=QString("%1").arg("%s", string); + outstring+=QString().sprintf("%s", string); else - outstring+=QString("%1").arg("&#%u;", (unsigned int)param); + outstring+=QString().sprintf("&#%u;", (unsigned int)param); done++; } if @@ -1697,9 +2158,9 @@ static int cmd_u (Word *w, int align, char has_param, int param) { { const char *string; if ((string = op->unisymbol2_translation_table[param - op->unisymbol2_first_char]) != 0) - outstring+=QString("%1").arg("%s", string); + outstring+=QString().sprintf("%s", string); else - outstring+=QString("%1").arg("&#%u;", (unsigned int)param); + outstring+=QString().sprintf("&#%u;", (unsigned int)param); done++; } if @@ -1711,9 +2172,9 @@ static int cmd_u (Word *w, int align, char has_param, int param) { { const char *string; if ((string = op->unisymbol3_translation_table[param - op->unisymbol3_first_char]) != 0) - outstring+=QString("%1").arg("%s", string); + outstring+=QString().sprintf("%s", string); else - outstring+=QString("%1").arg("&#%u;", (unsigned int)param); + outstring+=QString().sprintf("&#%u;", (unsigned int)param); done++; } #if 1 /* 0.19.5 more unicode support */ @@ -1726,9 +2187,16 @@ static int cmd_u (Word *w, int align, char has_param, int param) { { const char *string; if ((string = op->unisymbol4_translation_table[param - op->unisymbol4_first_char]) != 0) - outstring+=QString("%1").arg("%s", string); + outstring+=QString().sprintf("%s", string); else - outstring+=QString("%1").arg("&#%u;", (unsigned int)param); + outstring+=QString().sprintf("&#%u;", (unsigned int)param); + done++; + } +#endif +#if 1 /* 0.20.3 - daved added missing function call for unprocessed chars */ + if(!done && op->unisymbol_print) + { + outstring+=QString().sprintf("%s", op->unisymbol_print(param)); done++; } #endif @@ -1869,7 +2337,7 @@ static int cmd_s (Word *w, int align, char has_param, int param) { static int cmd_sect (Word *w, int align, char has_param, int param) { /* XX kludge */ if (op->paragraph_begin) { - outstring+=QString("%1").arg(op->paragraph_begin); + outstring+=QString().sprintf(op->paragraph_begin); } return FALSE; } @@ -1883,9 +2351,9 @@ static int cmd_sect (Word *w, int align, char has_param, int param) { static int cmd_shp (Word *w, int align, char has_param, int param) { if (op->comment_begin) { - printf("%s",op->comment_begin); - printf("Drawn Shape (ignored--not implemented yet)"); - printf("%s",op->comment_begin); + outstring+=QString().sprintf(op->comment_begin); + outstring+=QString().sprintf("Drawn Shape (ignored--not implemented yet)"); + outstring+=QString().sprintf(op->comment_end); /* daved 0.20.2 */ } return FALSE; @@ -1916,9 +2384,37 @@ static int cmd_outl (Word *w, int align, char has_param, int param) { static int cmd_ansi (Word *w, int align, char has_param, int param) { charset_type = CHARSET_ANSI; if (op->comment_begin) { - printf("%s",op->comment_begin); - printf("document uses ANSI character set"); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("document uses ANSI character set"); + outstring+=QString().sprintf("%s",op->comment_end); + } + return FALSE; +} + +/*======================================================================== + * Name: cmd_ansicpg + * Purpose: Executes the \ansicpg command. + * Args: Word, paragraph align info, and numeric param if any. + * Returns: Flag, true only if rest of Words on line should be ignored. + *=======================================================================*/ + +static int cmd_ansicpg (Word *w, int align, char has_param, int param) { + int i; + for (i = 0; i < sizeof(codepages) / sizeof(CodepageInfo); i ++) { + charset_codepage = &codepages[i]; + if (charset_codepage->cp == param) { + if (op->comment_begin) { + outstring+=QString().sprintf(op->comment_begin); + outstring+=QString().sprintf("document uses ANSI codepage %d character set", param); + outstring+=QString().sprintf(op->comment_end); + } + break; + } + } + if ((charset_codepage == NULL || charset_codepage->cp == 0) && op->comment_begin) { + outstring+=QString().sprintf(op->comment_begin); + outstring+=QString().sprintf("document uses default ANSI codepage character set"); + outstring+=QString().sprintf(op->comment_end); } return FALSE; } @@ -1933,9 +2429,9 @@ static int cmd_ansi (Word *w, int align, char has_param, int param) { static int cmd_pc (Word *w, int align, char has_param, int param) { charset_type = CHARSET_CP437 ; if (op->comment_begin) { - printf("%s",op->comment_begin); - printf("document uses PC codepage 437 character set"); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("document uses PC codepage 437 character set"); + outstring+=QString().sprintf("%s",op->comment_end); } return FALSE; } @@ -1950,9 +2446,9 @@ static int cmd_pc (Word *w, int align, char has_param, int param) { static int cmd_pca (Word *w, int align, char has_param, int param) { charset_type = CHARSET_CP850; if (op->comment_begin) { - printf("%s",op->comment_begin); - printf("document uses PC codepage 850 character set"); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("document uses PC codepage 850 character set"); + outstring+=QString().sprintf("%s",op->comment_end); } return FALSE; } @@ -1967,9 +2463,9 @@ static int cmd_pca (Word *w, int align, char has_param, int param) { static int cmd_mac (Word *w, int align, char has_param, int param) { charset_type = CHARSET_MAC; if (op->comment_begin) { - printf("%s",op->comment_begin); - printf("document uses Macintosh character set"); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("document uses Macintosh character set"); + outstring+=QString().sprintf("%s",op->comment_end); } return FALSE; } @@ -2307,6 +2803,7 @@ static HashItem hashArray_other [] = { }; static HashItem hashArray_a [] = { { "ansi", &cmd_ansi , NULL }, + { "ansicpg", &cmd_ansicpg , NULL }, { NULL, NULL, NULL} }; static HashItem hashArray_b [] = { @@ -2609,7 +3106,7 @@ enum { SMALL=0, BIG=1 }; if (simulate_smallcaps) { if (*s >= 'a' && *s <= 'z') { state=SMALL; - outstring+=QString("%1").arg(op->smaller_begin); + outstring+=QString().sprintf(op->smaller_begin); } else state=BIG; @@ -2623,14 +3120,14 @@ enum { SMALL=0, BIG=1 }; if (ch >= 0x20 && ch < 0x80) { #if 1 /* daved - 0.19.6 */ - post_trans = op_translate_char (op, charset_type, ch, numchar_table); + post_trans = op_translate_char (op, charset_type, charset_codepage, ch, numchar_table); #else - post_trans = op_translate_char (op, charset_type, ch); + post_trans = op_translate_char (op, charset_type, charset_codepage, ch); #endif #if 1 /* daved - 0.20.1 */ if(post_trans) #endif - outstring+=QString("%1").arg("%s",post_trans); + outstring+=QString().sprintf("%s",post_trans); } s++; @@ -2639,13 +3136,13 @@ enum { SMALL=0, BIG=1 }; ch = *s; if (ch >= 'a' && ch <= 'z') { if (state==BIG) - outstring+=QString("%1").arg(op->smaller_begin); + outstring+=QString().sprintf(op->smaller_begin); state=SMALL; } else { if (state==SMALL) - outstring+=QString("%1").arg(op->smaller_end); + outstring+=QString().sprintf(op->smaller_end); state=BIG; } } @@ -2671,7 +3168,7 @@ begin_table() have_printed_cell_end = FALSE; attrstack_push(); starting_body(); - outstring+=QString("%1").arg(op->table_begin); + outstring+=QString().sprintf(op->table_begin); } @@ -2689,12 +3186,12 @@ end_table () if (within_table) { if (!have_printed_cell_end) { attr_pop_dump(); - outstring+=QString("%1").arg(op->table_cell_end); + outstring+=QString().sprintf(op->table_cell_end); } if (!have_printed_row_end) { - outstring+=QString("%1").arg(op->table_row_end); + outstring+=QString().sprintf(op->table_row_end); } - outstring+=QString("%1").arg(op->table_end); + outstring+=QString().sprintf(op->table_end); within_table=FALSE; have_printed_row_begin = FALSE; have_printed_cell_begin = FALSE; @@ -2716,13 +3213,13 @@ void starting_text() { if (within_table) { if (!have_printed_row_begin) { - outstring+=QString("%1").arg(op->table_row_begin); + outstring+=QString().sprintf(op->table_row_begin); have_printed_row_begin=TRUE; have_printed_row_end=FALSE; have_printed_cell_begin=FALSE; } if (!have_printed_cell_begin) { - outstring+=QString("%1").arg(op->table_cell_begin); + outstring+=QString().sprintf(op->table_cell_begin); attrstack_express_all(); have_printed_cell_begin=TRUE; have_printed_cell_end=FALSE; @@ -2749,15 +3246,15 @@ starting_paragraph_align (int align) switch (align) { case ALIGN_CENTER: - outstring+=QString("%1").arg(op->center_begin); + outstring+=QString().sprintf(op->center_begin); break; case ALIGN_LEFT: break; case ALIGN_RIGHT: - outstring+=QString("%1").arg(op->align_right_begin); + outstring+=QString().sprintf(op->align_right_begin); break; case ALIGN_JUSTIFY: - outstring+=QString("%1").arg(op->align_right_begin); /* This is WRONG! */ + outstring+=QString().sprintf(op->align_right_begin); /* This is WRONG! */ break; } } @@ -2776,16 +3273,16 @@ ending_paragraph_align (int align) { switch (align) { case ALIGN_CENTER: - outstring+=QString("%1").arg(op->center_end); + outstring+=QString().sprintf(op->center_end); break; case ALIGN_LEFT: - /* printf(op->align_left_end); */ + /* outstring+=QString().sprintf(op->align_left_end); */ break; case ALIGN_RIGHT: - outstring+=QString("%1").arg(op->align_right_end); + outstring+=QString().sprintf(op->align_right_end); break; case ALIGN_JUSTIFY: - outstring+=QString("%1").arg(op->justify_end); + outstring+=QString().sprintf(op->justify_end); break; } } @@ -2861,15 +3358,15 @@ word_print_core (Word *w) if (s[0]!=' ') { char *s2; - printf("%s",op->comment_begin); - printf("picture data found, "); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("picture data found, "); if (picture_wmetafile_type_str) { printf("WMF type is %s, ", picture_wmetafile_type_str); } printf("picture dimensions are %d by %d, depth %d", picture_width, picture_height, picture_bits_per_pixel); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_end); if (picture_width && picture_height && picture_bits_per_pixel) { s2=s; while (*s2) { @@ -2894,12 +3391,12 @@ word_print_core (Word *w) total_chars_this_line += strlen(s); if (op->word_begin) - outstring+=QString("%1").arg(op->word_begin); + outstring+=QString().sprintf(op->word_begin); print_with_special_exprs (s); if (op->word_end) - outstring+=QString("%1").arg(op->word_end); + outstring+=QString().sprintf(op->word_end); } @@ -2959,24 +3456,24 @@ word_print_core (Word *w) is_cell_group=TRUE; if (!have_printed_cell_begin) { /* Need this with empty cells */ - outstring+=QString("%1").arg(op->table_cell_begin); + outstring+=QString().sprintf(op->table_cell_begin); attrstack_express_all(); } attr_pop_dump(); - outstring+=QString("%1").arg(op->table_cell_end); + outstring+=QString().sprintf(op->table_cell_end); have_printed_cell_begin = FALSE; have_printed_cell_end=TRUE; } else if (!strcmp (s, "row")) { if (within_table) { - outstring+=QString("%1").arg(op->table_row_end); + outstring+=QString().sprintf(op->table_row_end); have_printed_row_begin = FALSE; have_printed_row_end=TRUE; } else { if (debug_mode) { - printf("%s",op->comment_begin); - printf("end of table row"); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("end of table row"); + outstring+=QString().sprintf("%s",op->comment_end); } } } @@ -2988,21 +3485,21 @@ word_print_core (Word *w) const char *s2; #if 1 /* daved - 0.19.6 */ - s2 = op_translate_char (op, charset_type, ch, numchar_table); + s2 = op_translate_char (op, charset_type, charset_codepage, ch, numchar_table); #else - s2 = op_translate_char (op, charset_type, ch); + s2 = op_translate_char (op, charset_type, charset_codepage, ch); #endif if (!s2 || !*s2) { - printf("%s",op->comment_begin); - printf("char 0x%02x",ch); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("char 0x%02x",ch); + outstring+=QString().sprintf("%s",op->comment_end); } else { if (op->word_begin) - outstring+=QString("%1").arg(op->word_begin); - outstring+=QString("%1").arg("%s", s2); + outstring+=QString().sprintf(op->word_begin); + outstring+=QString().sprintf("%s", s2); if (op->word_end) - outstring+=QString("%1").arg(op->word_end); + outstring+=QString().sprintf(op->word_end); } } else @@ -3032,9 +3529,9 @@ word_print_core (Word *w) if (!hip) { if (debug_mode) { - printf("%s",op->comment_begin); - printf("Unfamiliar RTF command: %s (HashIndex not found)", s); - printf("%s",op->comment_begin); + outstring+=QString().sprintf(op->comment_begin); + outstring+=QString().sprintf("Unfamiliar RTF command: %s (HashIndex not found)", s); + outstring+=QString().sprintf(op->comment_end); /* daved 0.20.2 */ } } else { @@ -3068,9 +3565,9 @@ word_print_core (Word *w) debug=hip[index].debug_print; if (debug && debug_mode) { - printf("%s",op->comment_begin); - printf("%s", debug); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("%s", debug); + outstring+=QString().sprintf("%s",op->comment_end); } done=TRUE; @@ -3084,9 +3581,9 @@ word_print_core (Word *w) } if (!match) { if (debug_mode) { - printf("%s",op->comment_begin); - printf("Unfamiliar RTF command: %s", s); - printf("%s",op->comment_end); + outstring+=QString().sprintf("%s",op->comment_begin); + outstring+=QString().sprintf("Unfamiliar RTF command: %s", s); + outstring+=QString().sprintf("%s",op->comment_end); } } } @@ -3113,9 +3610,9 @@ word_print_core (Word *w) if (within_picture) { if(pictfile) { fclose(pictfile); - outstring+=QString("%1").arg(op->imagelink_begin); - outstring+=QString("%1").arg("%s", picture_path); - outstring+=QString("%1").arg(op->imagelink_end); + outstring+=QString().sprintf(op->imagelink_begin); + outstring+=QString().sprintf("%s", picture_path); + outstring+=QString().sprintf(op->imagelink_end); } within_picture=FALSE; } @@ -3134,6 +3631,21 @@ word_print_core (Word *w) ending_paragraph_align (paragraph_align); attrstack_drop(); + +#if 1 /* daved - 0.20.3 */ + if(0) + outstring+=QString().sprintf("", numchar_table); + if((s = attr_get_param(ATTR_FONTFACE)) != NULL && + strstr(s,"Symbol") != NULL) + numchar_table=FONTSYMBOL_TABLE; + else if((s = attr_get_param(ATTR_FONTFACE)) != NULL && + strstr(s,"Greek") != NULL) + numchar_table=FONTGREEK_TABLE; + else + numchar_table = FONTROMAN_TABLE; + if(0) + outstring+=QString().sprintf("", numchar_table); +#endif } @@ -3153,8 +3665,8 @@ word_print (Word *w, QString & _s) outstring = ""; if (!inline_mode) { - outstring+=QString("%1").arg(op->document_begin); - outstring+=QString("%1").arg(op->header_begin); + outstring+=QString().sprintf(op->document_begin); + outstring+=QString().sprintf(op->header_begin); } within_header=TRUE; @@ -3165,8 +3677,8 @@ word_print (Word *w, QString & _s) end_table(); if (!inline_mode) { - outstring+=QString("%1").arg(op->body_end); - outstring+=QString("%1").arg(op->document_end); + outstring+=QString().sprintf(op->body_end); + outstring+=QString().sprintf(op->document_end); } _s = outstring; } diff --git a/plugins/flp_import/unrtf/convert.h b/plugins/flp_import/unrtf/convert.h index ea523eb23..497a2188d 100644 --- a/plugins/flp_import/unrtf/convert.h +++ b/plugins/flp_import/unrtf/convert.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -28,7 +28,8 @@ * Purpose: Definitions for the conversion module *---------------------------------------------------------------------- * Changes: - * 31 March 2005 by daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 31 Mar 05, by daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ @@ -38,7 +39,7 @@ enum { CHARSET_ANSI=1, CHARSET_MAC, CHARSET_CP437, - CHARSET_CP850 + CHARSET_CP850, }; #ifndef _WORD @@ -48,9 +49,10 @@ enum { extern void word_print (Word*, QString & _s); #if 1 /* daved 0.19.6 - support for multiple char number->output tables */ - short numchar_table; + extern short numchar_table; #define FONTROMAN_TABLE 0 #define FONTSYMBOL_TABLE 1 +#define FONTGREEK_TABLE 2 #endif #define _CONVERT diff --git a/plugins/flp_import/unrtf/defs.h b/plugins/flp_import/unrtf/defs.h index 6e280a2d2..f4c2d5b5b 100644 --- a/plugins/flp_import/unrtf/defs.h +++ b/plugins/flp_import/unrtf/defs.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -35,6 +35,9 @@ * 09 Oct 03, daved@physiol.usyd.edu.au: changed to GNU website * 17 Feb 04, marcossamaral@terra.com.br: changed some information * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 + * 17 Dec 07, daved@physiol.usyd.edu.au: added --noremap to usage - from + * David Santinoli *--------------------------------------------------------------------*/ @@ -61,7 +64,7 @@ #endif -#define USAGE "unrtf [--version] [--verbose] [--help] [--nopict|-n] [--html] [--text] [--vt] [--latex] [-t html|text|vt|latex] " +#define USAGE "unrtf [--version] [--verbose] [--help] [--nopict|-n] [--noremap] [--html] [--text] [--vt] [--latex] [-t html|text|vt|latex] " /* Default names for RTF's default fonts */ diff --git a/plugins/flp_import/unrtf/error.c b/plugins/flp_import/unrtf/error.c index 1a7ca8928..5d8b1792c 100644 --- a/plugins/flp_import/unrtf/error.c +++ b/plugins/flp_import/unrtf/error.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -37,6 +37,7 @@ * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 22 Aug 05, ax2groin@arbornet.org: added lineno to error_handler * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H diff --git a/plugins/flp_import/unrtf/error.h b/plugins/flp_import/unrtf/error.h index 6ade02a4c..438979277 100644 --- a/plugins/flp_import/unrtf/error.h +++ b/plugins/flp_import/unrtf/error.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -30,6 +30,7 @@ * Changes * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ diff --git a/plugins/flp_import/unrtf/hash.c b/plugins/flp_import/unrtf/hash.c index 18c7092e4..a51cc745f 100644 --- a/plugins/flp_import/unrtf/hash.c +++ b/plugins/flp_import/unrtf/hash.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -38,6 +38,7 @@ * 08 Oct 03, daved@physiol.usyd.edu.au: some type fixes * 29 Mar 05, daved@physiol.usyd.edu.au: changes requsted by ZT Smith * 06 Jan 06, marcossamaral@terra.com.br: changes hash_stats function + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H diff --git a/plugins/flp_import/unrtf/hash.h b/plugins/flp_import/unrtf/hash.h index 5b1c44681..7aea699d6 100644 --- a/plugins/flp_import/unrtf/hash.h +++ b/plugins/flp_import/unrtf/hash.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -29,6 +29,7 @@ * Changes: * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 06 Jan 06, marcossamaral@terra.com.br: changes hash_stats() + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ diff --git a/plugins/flp_import/unrtf/html.c b/plugins/flp_import/unrtf/html.c index 0a5fe30bb..69661dba5 100644 --- a/plugins/flp_import/unrtf/html.c +++ b/plugins/flp_import/unrtf/html.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -39,6 +39,8 @@ * 19 Aug 05, ax2groin@arbornet.org: added more chars and changes to ANSI * 05 Jan 06, marcossamaral@terra.com.br: fixed bugs #14982 and #14983 * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 13 Dec 07, daved@physiol.usyd.edu.au: fixed some missing entity ';' + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H @@ -644,8 +646,8 @@ static const char* cp437 [] = { /* 0x9b */ "¢", /* 0x9c */ "£", /* 0x9d */ "¥", -/* 0x9e */ "₧", /* peseta */ -/* 0x9f */ "ƒ", /* small f with hook */ +/* 0x9e */ "₧", /* peseta */ +/* 0x9f */ "ƒ", /* small f with hook */ /* 0xa0 */ "á", /* 0xa1 */ "í", /* 0xa2 */ "ó", @@ -655,7 +657,7 @@ static const char* cp437 [] = { /* 0xa6 */ "ª", /* 0xa7 */ "¼", /* 0xa8 */ "¿", -/* 0xa9 */ "⌐", /* reversed not */ +/* 0xa9 */ "⌐", /* reversed not */ /* 0xaa */ "¬", /* 0xab */ "½", /* 0xac */ "»", @@ -874,6 +876,159 @@ static const char* cp850 [] = { /* 0xfe */ "■", /* black square */ /* 0xff */ " ", }; +#if 1 /* daved - 0.20.3 */ +static char * Greek[] = +{ +/* 0x80 */ "ç", +/* 0x81 */ "ü", +/* 0x82 */ "é", +/* 0x83 */ "â", +/* 0x84 */ "ä", +/* 0x85 */ "à", +/* 0x86 */ "å", +/* 0x87 */ "ç", +/* 0x88 */ "ê", +/* 0x89 */ "ë", +/* 0x8a */ "è", +/* 0x8b */ "ï", +/* 0x8c */ "î", +/* 0x8d */ "ì", +/* 0x8e */ "ä", +/* 0x8f */ "å", +/* 0x90 */ "é", +/* 0x91 */ "æ", +/* 0x92 */ "æ", +/* 0x93 */ "ô", +/* 0x94 */ "ö", +/* 0x95 */ "ò", +/* 0x96 */ "û", +/* 0x97 */ "ù", +/* 0x98 */ "ÿ", +/* 0x99 */ "ö", +/* 0x9a */ "ü", +/* 0x9b */ "ø", +/* 0x9c */ "£", +/* 0x9d */ "ø", +/* 0x9e */ "×", +/* 0x9f */ "ƒ", /* small f with hook */ +/* 0xa0 */ "á", +/* 0xa1 */ "í", +/* 0xa2 */ "ó", +/* 0xa3 */ "ú", +/* 0xa4 */ "ñ", +/* 0xa5 */ "ñ", +/* 0xa6 */ "ª", +/* 0xa7 */ "¼", +/* 0xa8 */ "¿", +/* 0xa9 */ "®", +/* 0xaa */ "¬", +/* 0xab */ "½", +/* 0xac */ "»", +/* 0xad */ "¡", +/* 0xae */ "«", +/* 0xaf */ "º", +/* 0xb0 */ "░", /* light shade */ +/* 0xb1 */ "▒", /* med. shade */ +/* 0xb2 */ "▓", /* dark shade */ +/* 0xb3 */ "│", /* box-draw light vert. */ +/* 0xb4 */ "┤", /* box-draw light vert. + lt. */ +/* 0xb5 */ "á", +/* 0xb6 */ "â", +/* 0xb7 */ "à", +/* 0xb8 */ "©", +/* 0xb9 */ "╣", /* box-draw dbl. vert. + lt. */ +/* 0xba */ "║", /* box-draw dbl. vert. */ +/* 0xbb */ "╗", /* box-draw dbl. dn. + lt. */ +/* 0xbc */ "╝", /* box-draw dbl. up + lt. */ +/* 0xbd */ "¢", +/* 0xbe */ "¥", +/* 0xbf */ "┐", /* box-draw light dn. + lt. */ +/* 0xc0 */ "└", /* box-draw light up + rt. */ +/* 0xc1 */ "┴", /* box-draw light up + horiz. */ +/* 0xc2 */ "┬", /* box-draw light dn. + horiz. */ +/* 0xc3 */ "├", /* box-draw light vert. + rt. */ +/* 0xc4 */ "─", /* box-draw light horiz. */ +/* 0xc5 */ "┼", /* box-draw light vert. + horiz. */ +/* 0xc6 */ "ã", +/* 0xc7 */ "ã", +/* 0xc8 */ "╚", /* box-draw dbl. up + rt. */ +/* 0xc9 */ "╔", /* box-draw dbl. dn. + rt. */ +/* 0xca */ "╩", /* box-draw dbl. up + horiz. */ +/* 0xcb */ "╦", /* box-draw dbl. dn. + horiz. */ +/* 0xcc */ "╠", /* box-draw dbl. vert. + rt. */ +/* 0xcd */ "═", /* box-draw dbl. horiz. */ +/* 0xce */ "╬", /* box-draw dbl. vert. + horiz. */ +/* 0xcf */ "¤", +/* 0xd0 */ "ð", +/* 0xd1 */ "ð", +/* 0xd2 */ "ê", +/* 0xd3 */ "ë", +/* 0xd4 */ "è", +/* 0xd5 */ "ı", /* small dotless i */ +/* 0xd6 */ "í", +/* 0xd7 */ "î", +/* 0xd8 */ "ï", +/* 0xd9 */ "┘", /* box-draw light up + lt. */ +/* 0xda */ "┌", /* box-draw light dn. + rt. */ +/* 0xdb */ "█", /* full-block */ +/* 0xdc */ "▄", /* lower 1/2 block */ +/* 0xdd */ "¦", +/* 0xde */ "ì", +/* 0xdf */ "▀", /* upper 1/2 block */ +/* 0xe0 */ "ó", +/* above here not done */ +/* 0xe1 */ "α", +/* 0xe2 */ "β", +/* 0xe3 */ "γ", +/* 0xe4 */ "δ", +/* 0xe5 */ "ε", +/* 0xe6 */ "ζ", +/* 0xe7 */ "η", +/* 0xe8 */ "θ", +/* 0xe9 */ "ι", +/* 0xea */ "κ", +/* 0xeb */ "λ", +/* 0xec */ "μ", +/* 0xed */ "ν", +/* 0xee */ "ξ", +/* 0xef */ "ο", +/* 0xf0 */ "π", +/* 0xf1 */ "ρ", +/* 0xf2 */ "ς", +/* 0xf3 */ "σ", +/* 0xf4 */ "τ", +/* 0xf5 */ "υ", +/* 0xf6 */ "φ", +/* 0xf7 */ "χ", +/* 0xf8 */ "ψ", +/* 0xf9 */ "&omiga;", +/* 0xfa */ "&iotauml;", +/* 0xfb */ "&nuuml;", +/* 0xfc */ "&omicronacute;", +/* 0xfd */ "&nuacute;", +/* 0xfe */ "&omegaacute;", /* black square */ +/* 0xff */ " ", +}; +#endif + + + + + +/*======================================================================== + * Name: html_unisymbol_print + * Purpose: Outputs arbitrary unicode symbol + * Args: Unsigned Short. + * Returns: String representing symbol. + *=======================================================================*/ + +char * +html_unisymbol_print (unsigned short c) +{ + char r[12]; + snprintf(r, 9, "&#%04d;", c); + return my_strdup(r); +} @@ -1098,6 +1253,13 @@ html_init (void) op->symbol_last_char = 254; op->symbol_translation_table = symbol; #endif +#if 1 /* daved - 0.20.3 - GREEK font support */ + op->greek_first_char = 0x80; + op->greek_last_char = 0xff; + op->greek_translation_table = Greek; +#endif + + op->unisymbol_print = html_unisymbol_print; return op; } diff --git a/plugins/flp_import/unrtf/html.h b/plugins/flp_import/unrtf/html.h index ad6bf5db4..4af30cdc6 100644 --- a/plugins/flp_import/unrtf/html.h +++ b/plugins/flp_import/unrtf/html.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -28,6 +28,7 @@ *---------------------------------------------------------------------- * Changes: * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ diff --git a/plugins/flp_import/unrtf/main.h b/plugins/flp_import/unrtf/main.h index 9752efe9f..446b1806c 100644 --- a/plugins/flp_import/unrtf/main.h +++ b/plugins/flp_import/unrtf/main.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -30,6 +30,7 @@ * 15 Oct 00, tuorfa@yahoo.com: removed echo_mode extern * 19 Sep 01, tuorfa@yahoo.com: added output personality * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ diff --git a/plugins/flp_import/unrtf/malloc.c b/plugins/flp_import/unrtf/malloc.c index efa813aee..693218285 100644 --- a/plugins/flp_import/unrtf/malloc.c +++ b/plugins/flp_import/unrtf/malloc.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -35,6 +35,7 @@ * 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H diff --git a/plugins/flp_import/unrtf/malloc.h b/plugins/flp_import/unrtf/malloc.h index 524f217ae..ac16123b4 100644 --- a/plugins/flp_import/unrtf/malloc.h +++ b/plugins/flp_import/unrtf/malloc.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -29,6 +29,7 @@ * Changes: * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ extern char * my_malloc (unsigned long); diff --git a/plugins/flp_import/unrtf/output.c b/plugins/flp_import/unrtf/output.c index 40e10393d..cadd5a365 100644 --- a/plugins/flp_import/unrtf/output.c +++ b/plugins/flp_import/unrtf/output.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -34,6 +34,9 @@ * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 06 Jan 06, marcossamaral@terra.com.br: changes in STDOUT * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 + * 17 Dec 07, daved@physiol.usyd.edu.au: added support for --noremap from + * David Santinoli *--------------------------------------------------------------------*/ @@ -114,16 +117,27 @@ op_free (OutputPersonality *op) const char * #if 1 /* daved - 0.19.6 */ -op_translate_char (OutputPersonality *op, int charset, int ch, int ntable) +op_translate_char (OutputPersonality *op, int charset, CodepageInfo *codepage, int ch, int ntable) #else -op_translate_char (OutputPersonality *op, int charset, int ch) +op_translate_char (OutputPersonality *op, int charset, CodepageInfo *codepage, int ch) #endif { short start; const char *result=NULL; +#if 1 /* daved - 0.20.5 */ + static char output_buffer[2]={ 0, 0 }; +#endif CHECK_PARAM_NOT_NULL(op); +#if 1 /* daved - 0.20.5 */ + if (no_remap_mode == TRUE && ch < 256) + { + output_buffer[0]=ch; + result=output_buffer; + } + else +#endif #if 1 /* daved - 0.19.6 */ /* if we are seeking a character from a symbol font we can be below 0x80 @@ -134,8 +148,21 @@ op_translate_char (OutputPersonality *op, int charset, int ch) if(ch >= start && ch <= op->symbol_last_char) result = op->symbol_translation_table[ch - start]; + if(result) + return result; } else +#endif +#if 1 /* daved - 0.20.3 */ + if(ntable == FONTGREEK_TABLE) + { + start = op->greek_first_char; + + if(ch >= start && ch <= op->greek_last_char) + result = op->greek_translation_table[ch - start]; + if(result) + return result; + } #endif if (ch >= 0x20 && ch < 0x80) { result = op->ascii_translation_table [ch - 0x20]; @@ -149,10 +176,23 @@ op_translate_char (OutputPersonality *op, int charset, int ch) else switch (charset) { case CHARSET_ANSI: + if (codepage != NULL && op->unisymbol_print != NULL && codepage->cp) + { + if(0) + printf("", codepage->chars[ch - 0x80]); + if (codepage->chars[ch - 0x80]) { + if(0) + printf(""); + result = op->unisymbol_print(codepage->chars[ch - 0x80]); + } + } + if(!result) + { start = op->ansi_first_char; - if (ch >= start && - ch <= op->ansi_last_char) - result = op->ansi_translation_table [ch-start]; + if (ch >= start && + ch <= op->ansi_last_char) + result = op->ansi_translation_table [ch-start]; + } break; case CHARSET_MAC: start = op->mac_first_char; @@ -198,49 +238,49 @@ op_begin_std_fontsize (OutputPersonality *op, int size) switch (size) { case 8: if (op->fontsize8_begin) { - outstring+=QString("%1").arg (op->fontsize8_begin); + outstring+=QString().sprintf(op->fontsize8_begin); found_std_expr = TRUE; } break; case 10: if (op->fontsize10_begin) { - outstring+=QString("%1").arg (op->fontsize10_begin); + outstring+=QString().sprintf(op->fontsize10_begin); found_std_expr = TRUE; } break; case 12: if (op->fontsize12_begin) { - outstring+=QString("%1").arg (op->fontsize12_begin); + outstring+=QString().sprintf(op->fontsize12_begin); found_std_expr = TRUE; } break; case 14: if (op->fontsize14_begin) { - outstring+=QString("%1").arg (op->fontsize14_begin); + outstring+=QString().sprintf(op->fontsize14_begin); found_std_expr = TRUE; } break; case 18: if (op->fontsize18_begin) { - outstring+=QString("%1").arg (op->fontsize18_begin); + outstring+=QString().sprintf(op->fontsize18_begin); found_std_expr = TRUE; } break; case 24: if (op->fontsize24_begin) { - outstring+=QString("%1").arg (op->fontsize24_begin); + outstring+=QString().sprintf(op->fontsize24_begin); found_std_expr = TRUE; } break; case 36: if (op->fontsize36_begin) { - outstring+=QString("%1").arg (op->fontsize36_begin); + outstring+=QString().sprintf(op->fontsize36_begin); found_std_expr = TRUE; } break; case 48: if (op->fontsize48_begin) { - outstring+=QString("%1").arg (op->fontsize48_begin); + outstring+=QString().sprintf(op->fontsize48_begin); found_std_expr = TRUE; } break; @@ -253,53 +293,53 @@ op_begin_std_fontsize (OutputPersonality *op, int size) if (op->fontsize_begin) { char expr[16]; sprintf (expr, "%d", size); - outstring+=QString("%1").arg (op->fontsize_begin, expr); + outstring+=QString().sprintf(op->fontsize_begin, expr); } else { /* If we cannot write out a change for the exact * point size, we must approximate to a standard * size. */ if (size<9 && op->fontsize8_begin) { - outstring+=QString("%1").arg (op->fontsize8_begin); + outstring+=QString().sprintf(op->fontsize8_begin); } else if (size<11 && op->fontsize10_begin) { - outstring+=QString("%1").arg (op->fontsize10_begin); + outstring+=QString().sprintf(op->fontsize10_begin); } else if (size<13 && op->fontsize12_begin) { - outstring+=QString("%1").arg (op->fontsize12_begin); + outstring+=QString().sprintf(op->fontsize12_begin); } else if (size<16 && op->fontsize14_begin) { - outstring+=QString("%1").arg (op->fontsize14_begin); + outstring+=QString().sprintf(op->fontsize14_begin); } else if (size<21 && op->fontsize18_begin) { - outstring+=QString("%1").arg (op->fontsize18_begin); + outstring+=QString().sprintf(op->fontsize18_begin); } else if (size<30 && op->fontsize24_begin) { - outstring+=QString("%1").arg (op->fontsize24_begin); + outstring+=QString().sprintf(op->fontsize24_begin); } else if (size<42 && op->fontsize36_begin) { - outstring+=QString("%1").arg (op->fontsize36_begin); + outstring+=QString().sprintf(op->fontsize36_begin); } else if (size>40 && op->fontsize48_begin) { - outstring+=QString("%1").arg (op->fontsize48_begin); + outstring+=QString().sprintf(op->fontsize48_begin); } else /* If we can't even produce a good approximation, * just try to get a font size near 12 point. */ if (op->fontsize12_begin) - outstring+=QString("%1").arg (op->fontsize12_begin); + outstring+=QString().sprintf(op->fontsize12_begin); else if (op->fontsize14_begin) - outstring+=QString("%1").arg (op->fontsize14_begin); + outstring+=QString().sprintf(op->fontsize14_begin); else if (op->fontsize10_begin) - outstring+=QString("%1").arg (op->fontsize10_begin); + outstring+=QString().sprintf(op->fontsize10_begin); else if (op->fontsize18_begin) - outstring+=QString("%1").arg (op->fontsize18_begin); + outstring+=QString().sprintf(op->fontsize18_begin); else if (op->fontsize8_begin) - outstring+=QString("%1").arg (op->fontsize8_begin); + outstring+=QString().sprintf(op->fontsize8_begin); else error_handler ("output personality lacks sufficient font size change capability"); } @@ -327,49 +367,49 @@ op_end_std_fontsize (OutputPersonality *op, int size) switch (size) { case 8: if (op->fontsize8_end) { - outstring+=QString("%1").arg (op->fontsize8_end); + outstring+=QString().sprintf(op->fontsize8_end); found_std_expr = TRUE; } break; case 10: if (op->fontsize10_end) { - outstring+=QString("%1").arg (op->fontsize10_end); + outstring+=QString().sprintf(op->fontsize10_end); found_std_expr = TRUE; } break; case 12: if (op->fontsize12_end) { - outstring+=QString("%1").arg (op->fontsize12_end); + outstring+=QString().sprintf(op->fontsize12_end); found_std_expr = TRUE; } break; case 14: if (op->fontsize14_end) { - outstring+=QString("%1").arg (op->fontsize14_end); + outstring+=QString().sprintf(op->fontsize14_end); found_std_expr = TRUE; } break; case 18: if (op->fontsize18_end) { - outstring+=QString("%1").arg (op->fontsize18_end); + outstring+=QString().sprintf(op->fontsize18_end); found_std_expr = TRUE; } break; case 24: if (op->fontsize24_end) { - outstring+=QString("%1").arg (op->fontsize24_end); + outstring+=QString().sprintf(op->fontsize24_end); found_std_expr = TRUE; } break; case 36: if (op->fontsize36_end) { - outstring+=QString("%1").arg (op->fontsize36_end); + outstring+=QString().sprintf(op->fontsize36_end); found_std_expr = TRUE; } break; case 48: if (op->fontsize48_end) { - outstring+=QString("%1").arg (op->fontsize48_end); + outstring+=QString().sprintf(op->fontsize48_end); found_std_expr = TRUE; } break; @@ -382,53 +422,53 @@ op_end_std_fontsize (OutputPersonality *op, int size) if (op->fontsize_end) { char expr[16]; sprintf (expr, "%d", size); - outstring+=QString("%1").arg (op->fontsize_end, expr); + outstring+=QString().sprintf(op->fontsize_end, expr); } else { /* If we cannot write out a change for the exact * point size, we must approximate to a standard * size. */ if (size<9 && op->fontsize8_end) { - outstring+=QString("%1").arg (op->fontsize8_end); + outstring+=QString().sprintf(op->fontsize8_end); } else if (size<11 && op->fontsize10_end) { - outstring+=QString("%1").arg (op->fontsize10_end); + outstring+=QString().sprintf(op->fontsize10_end); } else if (size<13 && op->fontsize12_end) { - outstring+=QString("%1").arg (op->fontsize12_end); + outstring+=QString().sprintf(op->fontsize12_end); } else if (size<16 && op->fontsize14_end) { - outstring+=QString("%1").arg (op->fontsize14_end); + outstring+=QString().sprintf(op->fontsize14_end); } else if (size<21 && op->fontsize18_end) { - outstring+=QString("%1").arg (op->fontsize18_end); + outstring+=QString().sprintf(op->fontsize18_end); } else if (size<30 && op->fontsize24_end) { - outstring+=QString("%1").arg (op->fontsize24_end); + outstring+=QString().sprintf(op->fontsize24_end); } else if (size<42 && op->fontsize36_end) { - outstring+=QString("%1").arg (op->fontsize36_end); + outstring+=QString().sprintf(op->fontsize36_end); } else if (size>40 && op->fontsize48_end) { - outstring+=QString("%1").arg (op->fontsize48_end); + outstring+=QString().sprintf(op->fontsize48_end); } else /* If we can't even produce a good approximation, * just try to get a font size near 12 point. */ if (op->fontsize12_end) - outstring+=QString("%1").arg (op->fontsize12_end); + outstring+=QString().sprintf(op->fontsize12_end); else if (op->fontsize14_end) - outstring+=QString("%1").arg (op->fontsize14_end); + outstring+=QString().sprintf(op->fontsize14_end); else if (op->fontsize10_end) - outstring+=QString("%1").arg (op->fontsize10_end); + outstring+=QString().sprintf(op->fontsize10_end); else if (op->fontsize18_end) - outstring+=QString("%1").arg (op->fontsize18_end); + outstring+=QString().sprintf(op->fontsize18_end); else if (op->fontsize8_end) - outstring+=QString("%1").arg (op->fontsize8_end); + outstring+=QString().sprintf(op->fontsize8_end); else error_handler ("output personality lacks sufficient font size change capability"); } diff --git a/plugins/flp_import/unrtf/output.h b/plugins/flp_import/unrtf/output.h index dcb30ea49..1ea6b4e1a 100644 --- a/plugins/flp_import/unrtf/output.h +++ b/plugins/flp_import/unrtf/output.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -28,12 +28,18 @@ *---------------------------------------------------------------------- * Changes: * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 * 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions *--------------------------------------------------------------------*/ #ifndef _OUTPUT +typedef struct { + int cp; + unsigned short chars[128]; +} CodepageInfo; + typedef struct { const char *comment_begin; @@ -276,6 +282,13 @@ typedef struct { short symbol_last_char; const char **symbol_translation_table; #endif +#if 1 /* daved 0.20.3 GREEK font support */ + short greek_first_char; + short greek_last_char; + char **greek_translation_table; +#endif + + char *(*unisymbol_print) (unsigned short); void (*write_set_foreground) (int,int,int); } @@ -285,9 +298,9 @@ OutputPersonality; extern OutputPersonality* op_create(void); extern void op_free (OutputPersonality*); #if 1 /* daved - 0.19.6 */ -extern const char* op_translate_char (OutputPersonality*,int,int, int); +extern const char* op_translate_char (OutputPersonality*,int,CodepageInfo*,int, int); #else -extern char* op_translate_char (OutputPersonality*,int,int); +extern char* op_translate_char (OutputPersonality*,int,CodepageInfo*,int); #endif extern void op_begin_std_fontsize (OutputPersonality*, int); diff --git a/plugins/flp_import/unrtf/parse.c b/plugins/flp_import/unrtf/parse.c index 188e17667..2826c76e5 100644 --- a/plugins/flp_import/unrtf/parse.c +++ b/plugins/flp_import/unrtf/parse.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -36,6 +36,7 @@ * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 08 Sep 03, daved@physiol.usyd.edu.au: type fixes; ANSI C fixes * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H diff --git a/plugins/flp_import/unrtf/parse.h b/plugins/flp_import/unrtf/parse.h index c1d8de2b7..b8f847679 100644 --- a/plugins/flp_import/unrtf/parse.h +++ b/plugins/flp_import/unrtf/parse.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -29,6 +29,7 @@ * Changes: * 15 Oct 00, tuorfa@yahoo.com: parse.h created with functions taken from word.c * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ diff --git a/plugins/flp_import/unrtf/util.c b/plugins/flp_import/unrtf/util.c index a7e987886..474f55a22 100644 --- a/plugins/flp_import/unrtf/util.c +++ b/plugins/flp_import/unrtf/util.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -29,6 +29,7 @@ * Changes: * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H diff --git a/plugins/flp_import/unrtf/util.h b/plugins/flp_import/unrtf/util.h index e49c0070b..890d66bab 100644 --- a/plugins/flp_import/unrtf/util.h +++ b/plugins/flp_import/unrtf/util.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -28,6 +28,7 @@ *---------------------------------------------------------------------- * Changes: * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ extern int h2toi (char *); diff --git a/plugins/flp_import/unrtf/word.c b/plugins/flp_import/unrtf/word.c index e1ff4c574..d863cdf71 100644 --- a/plugins/flp_import/unrtf/word.c +++ b/plugins/flp_import/unrtf/word.c @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -46,6 +46,7 @@ * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith * 11 Jan 07, jasp00@users.sourceforge.net: optimized unsafe loop + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifdef LMMS_HAVE_CONFIG_H diff --git a/plugins/flp_import/unrtf/word.h b/plugins/flp_import/unrtf/word.h index 8e42835de..959b3b2ac 100644 --- a/plugins/flp_import/unrtf/word.h +++ b/plugins/flp_import/unrtf/word.h @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -28,6 +28,7 @@ *---------------------------------------------------------------------- * Changes: * 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith + * 16 Dec 07, daved@physiol.usyd.edu.au: updated to GPL v3 *--------------------------------------------------------------------*/ #ifndef _WORD diff --git a/plugins/midi_import/midi_import.cpp b/plugins/midi_import/midi_import.cpp index 36db12ae9..964503403 100644 --- a/plugins/midi_import/midi_import.cpp +++ b/plugins/midi_import/midi_import.cpp @@ -292,20 +292,23 @@ bool midiImport::readSMF( trackContainer * _tc ) // Tempo stuff automationPattern * tap = _tc->tempoAutomationPattern(); - tap->clear(); - Alg_time_map * timeMap = seq->get_time_map(); - Alg_beats & beats = timeMap->beats; - for( int i = 0; i < beats.len - 1; i++ ) + if( tap ) { - Alg_beat_ptr b = &(beats[i]); - double tempo = ( beats[i + 1].beat - b->beat ) / - ( beats[i + 1].time - beats[i].time ); - tap->putValue( b->beat * ticksPerBeat, tempo * 60.0 ); - } - if( timeMap->last_tempo_flag ) - { - Alg_beat_ptr b = &( beats[beats.len - 1] ); - tap->putValue( b->beat * ticksPerBeat, timeMap->last_tempo * 60.0 ); + tap->clear(); + Alg_time_map * timeMap = seq->get_time_map(); + Alg_beats & beats = timeMap->beats; + for( int i = 0; i < beats.len - 1; i++ ) + { + Alg_beat_ptr b = &(beats[i]); + double tempo = ( beats[i + 1].beat - b->beat ) / + ( beats[i + 1].time - beats[i].time ); + tap->putValue( b->beat * ticksPerBeat, tempo * 60.0 ); + } + if( timeMap->last_tempo_flag ) + { + Alg_beat_ptr b = &( beats[beats.len - 1] ); + tap->putValue( b->beat * ticksPerBeat, timeMap->last_tempo * 60.0 ); + } } // Song events @@ -416,17 +419,17 @@ bool midiImport::readSMF( trackContainer * _tc ) break; case 7: - objModel = &ch->it->volumeModel(); + objModel = ch->it->volumeModel(); cc *= 100.0f; break; case 10: - objModel = &ch->it->panningModel(); + objModel = ch->it->panningModel(); cc = cc * 200.f - 100.0f; break; case 128: - objModel = &ch->it->pitchModel(); + objModel = ch->it->pitchModel(); cc = cc * 100.0f; break; } diff --git a/src/core/instrument_functions.cpp b/src/core/instrument_functions.cpp index c19a75245..07a73ba6a 100644 --- a/src/core/instrument_functions.cpp +++ b/src/core/instrument_functions.cpp @@ -113,43 +113,27 @@ chordCreator::chord chordCreator::s_chordTable[] = { chordCreator::tr( "m-Maj13" ), { 0, 3, 7, 11, 14, 21, -1 } }, { chordCreator::tr( "Major" ), { 0, 2, 4, 5, 7, 9, 11, -1 } }, - { chordCreator::tr( "Harmonic minor" ), { 0, 2, 3, 5, 7, 8, - 11, -1 } }, - { chordCreator::tr( "Melodic minor" ), { 0, 2, 3, 5, 7, 9, - 11, -1 } }, - { chordCreator::tr( "Whole tone" ), { 0, 2, 4, 6, 8, 10, - -1 } }, - { chordCreator::tr( "Diminished" ), { 0, 2, 3, 5, 6, 8, 9, - 11, -1 } }, - { chordCreator::tr( "Major pentatonic" ), { 0, 2, 4, 7, 10, - -1 } }, - { chordCreator::tr( "Minor pentatonic" ), { 0, 3, 5, 7, 10, - -1 } }, + { chordCreator::tr( "Harmonic minor" ), { 0, 2, 3, 5, 7, 8, 11, -1 } }, + { chordCreator::tr( "Melodic minor" ), { 0, 2, 3, 5, 7, 9, 11, -1 } }, + { chordCreator::tr( "Whole tone" ), { 0, 2, 4, 6, 8, 10, -1 } }, + { chordCreator::tr( "Diminished" ), { 0, 2, 3, 5, 6, 8, 9, 11, -1 } }, + { chordCreator::tr( "Major pentatonic" ), { 0, 2, 4, 7, 10, -1 } }, + { chordCreator::tr( "Minor pentatonic" ), { 0, 3, 5, 7, 10, -1 } }, { chordCreator::tr( "Jap in sen" ), { 0, 1, 5, 7, 10, -1 } }, - { chordCreator::tr( "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9, - 11, -1 } }, - { chordCreator::tr( "Dominant bebop" ), { 0, 2, 4, 5, 7, 9, - 10, 11, -1 } }, + { chordCreator::tr( "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9, 11, -1 } }, + { chordCreator::tr( "Dominant bebop" ), { 0, 2, 4, 5, 7, 9, 10, 11, -1 } }, { chordCreator::tr( "Blues" ), { 0, 3, 5, 6, 7, 10, -1 } }, { chordCreator::tr( "Arabic" ), { 0, 1, 4, 5, 7, 8, 11, -1 } }, - { chordCreator::tr( "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11, - -1 } }, - { chordCreator::tr( "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11, - -1 } }, - { chordCreator::tr( "Neopolitan minor" ), { 0, 1, 3, 5, 7, 9, - 11, -1 } }, - { chordCreator::tr( "Hungarian minor" ), { 0, 2, 3, 6, 7, 9, - 11, -1 } }, + { chordCreator::tr( "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11, -1 } }, + { chordCreator::tr( "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11, -1 } }, + { chordCreator::tr( "Neopolitan minor" ), { 0, 1, 3, 5, 7, 9, 11, -1 } }, + { chordCreator::tr( "Hungarian minor" ), { 0, 2, 3, 6, 7, 9, 11, -1 } }, { chordCreator::tr( "Dorian" ), { 0, 2, 3, 5, 7, 9, 10, -1 } }, - { chordCreator::tr( "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10, - -1 } }, + { chordCreator::tr( "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10, -1 } }, { chordCreator::tr( "Lydian" ), { 0, 2, 4, 6, 7, 9, 11, -1 } }, - { chordCreator::tr( "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10, - -1 } }, - { chordCreator::tr( "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10, - -1 } }, - { chordCreator::tr( "Locrian" ), { 0, 1, 3, 5, 6, 8, 10, - -1 } }, + { chordCreator::tr( "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10, -1 } }, + { chordCreator::tr( "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10, -1 } }, + { chordCreator::tr( "Locrian" ), { 0, 1, 3, 5, 6, 8, 10, -1 } }, { "", { -1, -1 } } diff --git a/src/core/main.cpp b/src/core/main.cpp index 91a90cd4e..d58482242 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -53,12 +53,14 @@ #include "config_mgr.h" #include "embed.h" #include "engine.h" +#include "import_filter.h" #include "lmms_style.h" #include "main_window.h" #include "project_renderer.h" #include "song.h" #include "basic_ops.h" + #warning TODO: move somewhere else static inline QString baseName( const QString & _file ) { @@ -79,11 +81,7 @@ inline void loadTranslation( const QString & _tname, } -Uint32 convertToS16( const sampleFrameA * RP _ab, - const fpp_t _frames, - const float _master_gain, - intSampleFrameA * RP _output_buffer, - const bool _convert_endian ); + int main( int argc, char * * argv ) { @@ -93,16 +91,9 @@ int main( int argc, char * * argv ) // init CPU specific optimized basic ops initBasicOps(); -#if 0 - sampleFrameA * buf = (sampleFrameA *) alignedMalloc( sizeof( sampleFrameA ) * 256 ); - intSampleFrameA * obuf = (intSampleFrameA*)alignedMalloc( sizeof( intSampleFrameA ) * 256 ); - for( int i = 0; i< 1000000; ++i ) - { - convertToS16( buf, 256, 0.7, obuf, false ); - } -return 0; -#endif - bool core_only = FALSE; + bool core_only = false; + bool exit_after_import = false; + QString file_to_load, file_to_save, file_to_import, render_out; for( int i = 1; i < argc; ++i ) { @@ -111,7 +102,7 @@ return 0; ( QString( argv[i] ) == "--help" || QString( argv[i] ) == "-h" ) ) ) { - core_only = TRUE; + core_only = true; break; } } @@ -120,10 +111,9 @@ return 0; new QCoreApplication( argc, argv ) : new QApplication( argc, argv ) ; - QString file_to_load, file_to_save, render_out; mixer::qualitySettings qs( mixer::qualitySettings::Mode_HighQuality ); - projectRenderer::outputSettings os( 44100, FALSE, 160, + projectRenderer::outputSettings os( 44100, false, 160, projectRenderer::Depth_16Bit ); projectRenderer::ExportFileFormats eff = projectRenderer::WaveFile; @@ -318,6 +308,17 @@ return 0; } ++i; } + else if( argc > i && + ( QString( argv[i] ) == "--import" ) ) + { + file_to_import = argv[i+1]; + ++i; + // exit after import? (only for debugging) + if( argc > i && QString( argv[i+1] ) == "-e" ) + { + exit_after_import = true; + } + } else { if( argv[i][0] == '-' ) @@ -408,11 +409,21 @@ return 0; srand( getpid() + time( 0 ) ); // we try to load given file - if( file_to_load != "" ) + if( !file_to_load.isEmpty() ) { engine::getMainWindow()->showMaximized(); engine::getSong()->loadProject( file_to_load ); } + else if( !file_to_import.isEmpty() ) + { + importFilter::import( file_to_import, + engine::getSong() ); + if( exit_after_import ) + { + return 0; + } + engine::getMainWindow()->showMaximized(); + } else { engine::getSong()->createNewProject(); @@ -422,7 +433,7 @@ return 0; else { // we're going to render our song - engine::init( FALSE ); + engine::init( false ); printf( "loading project...\n" ); engine::getSong()->loadProject( file_to_load ); printf( "done\n" ); diff --git a/src/gui/file_browser.cpp b/src/gui/file_browser.cpp index 8f15fd82a..6175bb1e9 100644 --- a/src/gui/file_browser.cpp +++ b/src/gui/file_browser.cpp @@ -39,6 +39,7 @@ #include "embed.h" #include "engine.h" #include "gui_templates.h" +#include "import_filter.h" #include "instrument.h" #include "instrument_track.h" #include "main_window.h" @@ -488,7 +489,10 @@ void fileBrowserTreeWidget::mouseMoveEvent( QMouseEvent * _me ) break; case fileItem::MidiFile: - new stringPairDrag( "midifile", +// don't allow dragging FLP-files as FLP import filter clears project +// without asking +// case fileItem::FlpFile: + new stringPairDrag( "importedproject", f->fullName(), embed::getIconPixmap( "midi_file" ), @@ -571,11 +575,23 @@ void fileBrowserTreeWidget::handleFile( fileItem * f, instrumentTrack * _it ) instrumentTrack::removeMidiPortNode( mmp ); _it->setSimpleSerializing(); _it->loadSettings( mmp.content().toElement() ); + break; } + case fileItem::ImportAsProject: + if( f->type() == fileItem::FlpFile && + !engine::getMainWindow()->mayChangeProject() ) + { + break; + } + importFilter::import( f->fullName(), + engine::getSong() ); + break; + case fileItem::NotSupported: default: break; + } engine::getMixer()->unlock(); } @@ -592,7 +608,8 @@ void fileBrowserTreeWidget::activateListItem( QTreeWidgetItem * _item, return; } - if( f->handling() == fileItem::LoadAsProject ) + if( f->handling() == fileItem::LoadAsProject || + f->handling() == fileItem::ImportAsProject ) { handleFile( f, NULL ); } @@ -963,17 +980,20 @@ void fileItem::determineFileType( void ) else if( ext == "mid" ) { m_type = MidiFile; + m_handling = ImportAsProject; } else if( ext == "flp" ) { m_type = FlpFile; + m_handling = ImportAsProject; } else { m_type = UnknownFile; } - if( !ext.isEmpty() && engine::pluginFileHandling().contains( ext ) ) + if( m_handling == NotSupported && + !ext.isEmpty() && engine::pluginFileHandling().contains( ext ) ) { m_handling = LoadByPlugin; // classify as sample if not classified by anything yet but can diff --git a/src/gui/track_container_view.cpp b/src/gui/track_container_view.cpp index f4bb083dc..6db6a7942 100644 --- a/src/gui/track_container_view.cpp +++ b/src/gui/track_container_view.cpp @@ -79,7 +79,7 @@ trackContainerView::trackContainerView( trackContainer * _tc ) : m_scrollArea->show(); m_rubberBand->hide(); - setAcceptDrops( TRUE ); + setAcceptDrops( true ); connect( engine::getSong(), SIGNAL( timeSignatureChanged( int, int ) ), this, SLOT( realignTracks() ) ); @@ -273,7 +273,7 @@ const trackView * trackContainerView::trackViewAt( const int _y ) const bool trackContainerView::allowRubberband( void ) const { - return( FALSE ); + return( false ); } @@ -304,7 +304,7 @@ void trackContainerView::clearAllTracks( void ) void trackContainerView::undoStep( journalEntry & _je ) { #if 0 - saveJournallingState( FALSE ); + saveJournallingState( false ); switch( _je.actionID() ) { case AddTrack: @@ -326,7 +326,7 @@ void trackContainerView::undoStep( journalEntry & _je ) case RemoveTrack: { multimediaProject mmp( - _je.data().toMap()["state"].toString(), FALSE ); + _je.data().toMap()["state"].toString(), false ); track::create( mmp.content().firstChild().toElement(), m_tc ); break; @@ -362,8 +362,8 @@ void trackContainerView::redoStep( journalEntry & _je ) void trackContainerView::dragEnterEvent( QDragEnterEvent * _dee ) { stringPairDrag::processDragEnterEvent( _dee, - QString( "presetfile,sampledata,samplefile,instrument,midifile," - "track_%1,track_%2" ). + QString( "presetfile,sampledata,samplefile,instrument," + "importedproject,track_%1,track_%2" ). arg( track::InstrumentTrack ). arg( track::SampleTrack ) ); } @@ -382,7 +382,7 @@ void trackContainerView::dropEvent( QDropEvent * _de ) track::create( track::InstrumentTrack, m_tc ) ); it->loadInstrument( value ); - //it->toggledInstrumentTrackButton( TRUE ); + //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( /*type == "sampledata" || */type == "samplefile" ) @@ -396,7 +396,7 @@ void trackContainerView::dropEvent( QDropEvent * _de ) value )]; instrument * i = it->loadInstrument( iname ); i->loadFile( value ); - //it->toggledInstrumentTrackButton( TRUE ); + //it->toggledInstrumentTrackButton( true ); _de->accept(); } else if( type == "presetfile" ) @@ -407,17 +407,17 @@ void trackContainerView::dropEvent( QDropEvent * _de ) m_tc ) ); it->loadTrackSpecificSettings( mmp.content().firstChild(). toElement() ); - //it->toggledInstrumentTrackButton( TRUE ); + //it->toggledInstrumentTrackButton( true ); _de->accept(); } - else if( type == "midifile" ) + else if( type == "importedproject" ) { importFilter::import( value, m_tc ); _de->accept(); } else if( type.left( 6 ) == "track_" ) { - multimediaProject mmp( value, FALSE ); + multimediaProject mmp( value, false ); track::create( mmp.content().firstChild().toElement(), m_tc ); _de->accept(); } @@ -429,7 +429,7 @@ void trackContainerView::dropEvent( QDropEvent * _de ) void trackContainerView::mousePressEvent( QMouseEvent * _me ) { - if( allowRubberband() == TRUE ) + if( allowRubberband() == true ) { m_origin = m_scrollArea->mapFromParent( _me->pos() ); m_rubberBand->setGeometry( QRect( m_origin, QSize() ) ); @@ -443,7 +443,7 @@ void trackContainerView::mousePressEvent( QMouseEvent * _me ) void trackContainerView::mouseMoveEvent( QMouseEvent * _me ) { - if( rubberBandActive() == TRUE ) + if( rubberBandActive() == true ) { m_rubberBand->setGeometry( QRect( m_origin, m_scrollArea->mapFromParent( _me->pos() ) ). diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index cb7c9036a..c6ff2c064 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -68,8 +68,8 @@ pattern::pattern( instrumentTrack * _instrument_track ) : m_patternType( BeatPattern ), m_steps( midiTime::stepsPerTact() ), m_frozenPattern( NULL ), - m_freezing( FALSE ), - m_freezeAborted( FALSE ) + m_freezing( false ), + m_freezeAborted( false ) { setName( _instrument_track->name() ); init(); @@ -84,7 +84,7 @@ pattern::pattern( const pattern & _pat_to_copy ) : m_patternType( _pat_to_copy.m_patternType ), m_steps( _pat_to_copy.m_steps ), m_frozenPattern( NULL ), - m_freezeAborted( FALSE ) + m_freezeAborted( false ) { for( noteVector::const_iterator it = _pat_to_copy.m_notes.begin(); it != _pat_to_copy.m_notes.end(); ++it ) @@ -121,7 +121,7 @@ void pattern::init( void ) { connect( engine::getSong(), SIGNAL( timeSignatureChanged( int, int ) ), this, SLOT( changeTimeSignature() ) ); - saveJournallingState( FALSE ); + saveJournallingState( false ); ensureBeatNotes(); @@ -136,7 +136,7 @@ midiTime pattern::length( void ) const { if( m_patternType == BeatPattern ) { - return( beatPatternLength() ); + return beatPatternLength(); } tick max_length = midiTime::ticksPerTact(); @@ -150,8 +150,8 @@ midiTime pattern::length( void ) const ( *it )->endPos() ); } } - return( midiTime( max_length ).nextFullTact() * - midiTime::ticksPerTact() ); + return midiTime( max_length ).nextFullTact() * + midiTime::ticksPerTact(); } @@ -178,8 +178,7 @@ midiTime pattern::beatPatternLength( void ) const midiTime::stepsPerTact() ; } - return( midiTime( max_length ).nextFullTact() * - midiTime::ticksPerTact() ); + return midiTime( max_length ).nextFullTact() * midiTime::ticksPerTact(); } @@ -225,7 +224,7 @@ note * pattern::addNote( const note & _new_note, const bool _quant_pos ) updateBBTrack(); - return( new_note ); + return new_note; } @@ -266,9 +265,12 @@ note * pattern::rearrangeNote( const note * _note_to_proc, note copy_of_note( *_note_to_proc ); removeNote( _note_to_proc ); - return( addNote( copy_of_note, _quant_pos ) ); + return addNote( copy_of_note, _quant_pos ); } + + + void pattern::rearrangeAllNotes( void ) { // sort notes by start time @@ -277,6 +279,8 @@ void pattern::rearrangeAllNotes( void ) } + + void pattern::clearNotes( void ) { engine::getMixer()->lock(); @@ -295,6 +299,23 @@ void pattern::clearNotes( void ) +void pattern::setStep( int _step, bool _enabled ) +{ + for( noteVector::iterator it = m_notes.begin(); it != m_notes.end(); + ++it ) + { + if( ( *it )->pos() == _step*DefaultTicksPerTact/16 && + ( *it )->length() <= 0 ) + { + ( *it )->setLength( _enabled ? + -DefaultTicksPerTact : 0 ); + } + } +} + + + + void pattern::setType( PatternTypes _new_pattern_type ) { if( _new_pattern_type == BeatPattern || @@ -465,7 +486,7 @@ void pattern::unfreeze( void ) void pattern::abortFreeze( void ) { - m_freezeAborted = TRUE; + m_freezeAborted = true; } @@ -510,7 +531,7 @@ void pattern::removeSteps( int _n ) trackContentObjectView * pattern::createView( trackView * _tv ) { - return( new patternView( this, _tv ) ); + return new patternView( this, _tv ); } @@ -522,7 +543,7 @@ void pattern::ensureBeatNotes( void ) // make sure, that all step-note exist for( int i = 0; i < m_steps; ++i ) { - bool found = FALSE; + bool found = false; for( noteVector::iterator it = m_notes.begin(); it != m_notes.end(); ++it ) { @@ -531,15 +552,15 @@ void pattern::ensureBeatNotes( void ) midiTime::stepsPerTact() && ( *it )->length() <= 0 ) { - found = TRUE; + found = true; break; } } - if( found == FALSE ) + if( found == false ) { addNote( note( midiTime( 0 ), midiTime( i * midiTime::ticksPerTact() / - midiTime::stepsPerTact() ) ), FALSE ); + midiTime::stepsPerTact() ) ), false ); } } } @@ -565,10 +586,10 @@ bool pattern::empty( void ) { if( ( *it )->length() != 0 ) { - return( FALSE ); + return false; } } - return( TRUE ); + return true; } @@ -614,12 +635,12 @@ patternFreezeStatusDialog::patternFreezeStatusDialog( QThread * _thread ) : m_progress( 0 ) { setWindowTitle( tr( "Freezing pattern..." ) ); - setModal( TRUE ); + setModal( true ); m_progressBar = new QProgressBar( this ); m_progressBar->setGeometry( 10, 10, 200, 24 ); m_progressBar->setMaximum( 100 ); - m_progressBar->setTextVisible( FALSE ); + m_progressBar->setTextVisible( false ); m_progressBar->show(); m_cancelBtn = new QPushButton( embed::getIconPixmap( "cancel" ), tr( "Cancel" ), this ); @@ -634,7 +655,7 @@ patternFreezeStatusDialog::patternFreezeStatusDialog( QThread * _thread ) : this, SLOT( updateProgress() ) ); update_timer->start( 100 ); - setAttribute( Qt::WA_DeleteOnClose, TRUE ); + setAttribute( Qt::WA_DeleteOnClose, true ); connect( this, SIGNAL( aborted() ), this, SLOT( reject() ) ); } @@ -731,20 +752,20 @@ void patternFreezeThread::run( void ) engine::getMixer()->setAudioDevice( freeze_recorder ); // prepare stuff for playing correct things later - engine::getSong()->playPattern( m_pattern, FALSE ); + engine::getSong()->playPattern( m_pattern, false ); song::playPos & ppp = engine::getSong()->getPlayPos( song::Mode_PlayPattern ); ppp.setTicks( 0 ); ppp.setCurrentFrame( 0 ); - ppp.m_timeLineUpdate = FALSE; + ppp.m_timeLineUpdate = false; - m_pattern->m_freezeAborted = FALSE; - m_pattern->m_freezing = TRUE; + m_pattern->m_freezeAborted = false; + m_pattern->m_freezing = true; // now render everything while( ppp < m_pattern->length() && - m_pattern->m_freezeAborted == FALSE ) + m_pattern->m_freezeAborted == false ) { freeze_recorder->processNextBuffer(); m_statusDlg->setProgress( ppp * 100 / m_pattern->length() ); @@ -752,20 +773,20 @@ void patternFreezeThread::run( void ) m_statusDlg->setProgress( 100 ); // render tails while( engine::getMixer()->hasPlayHandles() && - m_pattern->m_freezeAborted == FALSE ) + m_pattern->m_freezeAborted == false ) { freeze_recorder->processNextBuffer(); } - m_pattern->m_freezing = FALSE; + m_pattern->m_freezing = false; // reset song-editor settings engine::getSong()->stop(); - ppp.m_timeLineUpdate = TRUE; + ppp.m_timeLineUpdate = true; // create final sample-buffer if freezing was successful - if( m_pattern->m_freezeAborted == FALSE ) + if( m_pattern->m_freezeAborted == false ) { freeze_recorder->createSampleBuffer( &m_pattern->m_frozenPattern ); @@ -786,7 +807,7 @@ patternView::patternView( pattern * _pattern, trackView * _parent ) : trackContentObjectView( _pattern, _parent ), m_pat( _pattern ), m_paintPixmap(), - m_needsUpdate( TRUE ) + m_needsUpdate( true ) { if( s_stepBtnOn == NULL ) { @@ -818,7 +839,7 @@ patternView::patternView( pattern * _pattern, trackView * _parent ) : } setFixedHeight( parentWidget()->height() - 2 ); - setAutoResizeEnabled( FALSE ); + setAutoResizeEnabled( false ); toolTip::add( this, tr( "double-click to open this pattern in piano-roll\n" @@ -852,7 +873,7 @@ patternView::~patternView() void patternView::update( void ) { - m_needsUpdate = TRUE; + m_needsUpdate = true; m_pat->changeLength( m_pat->length() ); trackContentObjectView::update(); } @@ -928,20 +949,20 @@ void patternView::constructContextMenu( QMenu * _cm ) this, SLOT( changeName() ) ); _cm->addSeparator(); - bool freeze_separator = FALSE; + bool freeze_separator = false; if( !( m_pat->m_instrumentTrack->isMuted() || m_pat->isMuted() ) ) { _cm->addAction( embed::getIconPixmap( "freeze" ), m_pat->m_frozenPattern ? tr( "Refreeze" ) : tr( "Freeze" ), m_pat, SLOT( freeze() ) ); - freeze_separator = TRUE; + freeze_separator = true; } if( m_pat->m_frozenPattern ) { _cm->addAction( embed::getIconPixmap( "unfreeze" ), tr( "Unfreeze" ), m_pat, SLOT( unfreeze() ) ); - freeze_separator = TRUE; + freeze_separator = true; } if( freeze_separator ) { @@ -1023,7 +1044,7 @@ void patternView::mousePressEvent( QMouseEvent * _me ) } else if( m_pat->m_frozenPattern != NULL && _me->button() == Qt::LeftButton && - engine::getMainWindow()->isShiftPressed() == TRUE ) + engine::getMainWindow()->isShiftPressed() == true ) { QString s; new stringPairDrag( "sampledata", @@ -1098,7 +1119,7 @@ void patternView::wheelEvent( QWheelEvent * _we ) void patternView::paintEvent( QPaintEvent * ) { - if( m_needsUpdate == FALSE ) + if( m_needsUpdate == false ) { QPainter p( this ); p.drawPixmap( 0, 0, m_paintPixmap ); @@ -1107,9 +1128,9 @@ void patternView::paintEvent( QPaintEvent * ) m_pat->changeLength( m_pat->length() ); - m_needsUpdate = FALSE; + m_needsUpdate = false; - if( m_paintPixmap.isNull() == TRUE || m_paintPixmap.size() != size() ) + if( m_paintPixmap.isNull() == true || m_paintPixmap.size() != size() ) { m_paintPixmap = QPixmap( size() ); }