rewrote FLP import filter, various coding style fixes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1840 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-11-21 23:07:56 +00:00
parent ba271fb363
commit 3f854f65c1
41 changed files with 2808 additions and 984 deletions

View File

@@ -1,3 +1,92 @@
2008-11-21 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* 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 <superjoe30/at/gmail/dot/com>
* src/gui/piano_roll.cpp:

View File

@@ -45,7 +45,7 @@ template<ch_cnt_t CHANNELS/* = DEFAULT_CHANNELS*/>
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<filterTypes>( _idx );
m_type = static_cast<FilterTypes>( _idx );
return;
}
m_type = static_cast<filterTypes>( LowPass + _idx -
NumOfFilters );
m_type = static_cast<FilterTypes>( LowPass + _idx -
NumFilters );
if( m_subFilter == NULL )
{
m_subFilter = new basicFilters<CHANNELS>(
@@ -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;

View File

@@ -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 );

View File

@@ -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<effect *> effectList;

View File

@@ -187,7 +187,8 @@ public:
NotSupported,
LoadAsProject,
LoadAsPreset,
LoadByPlugin
LoadByPlugin,
ImportAsProject
} ;

View File

@@ -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;
}

View File

@@ -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<instrumentTrack>() );
return castModel<instrumentTrack>();
}
const instrumentTrack * model( void ) const
{
return( castModel<instrumentTrack>() );
return castModel<instrumentTrack>();
}
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<instrumentTrack>() );
return castModel<instrumentTrack>();
}
const instrumentTrack * model( void ) const
{
return( castModel<instrumentTrack>() );
return castModel<instrumentTrack>();
}
void setInstrumentTrackView( instrumentTrackView * _tv )

View File

@@ -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 );

View File

@@ -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;
}

View File

@@ -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)

File diff suppressed because it is too large Load Diff

View File

@@ -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<QPair<int, note> > patternNoteVector;
patternNoteVector m_notes;
typedef QList<int> stepVector;
stepVector m_steps;
typedef QList<Uint32> playListItems;
playListItems m_plItems;
} ;

View File

@@ -0,0 +1,69 @@
/*
* unrtf.cpp - integration of UnRTF
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtCore/QString>
#include <QtCore/QBuffer>
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"
}

View File

@@ -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 <u> */
@@ -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 </u> */
@@ -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

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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] <filename>"
#define USAGE "unrtf [--version] [--verbose] [--help] [--nopict|-n] [--noremap] [--html] [--text] [--vt] [--latex] [-t html|text|vt|latex] <filename>"
/* Default names for RTF's default fonts */

View File

@@ -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

View File

@@ -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
*--------------------------------------------------------------------*/

View File

@@ -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

View File

@@ -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
*--------------------------------------------------------------------*/

View File

@@ -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 */ "&cent;",
/* 0x9c */ "&pound;",
/* 0x9d */ "&yen;",
/* 0x9e */ "&#8359", /* peseta */
/* 0x9f */ "&#402", /* small f with hook */
/* 0x9e */ "&#8359;", /* peseta */
/* 0x9f */ "&#402;", /* small f with hook */
/* 0xa0 */ "&aacute;",
/* 0xa1 */ "&iacute;",
/* 0xa2 */ "&oacute;",
@@ -655,7 +657,7 @@ static const char* cp437 [] = {
/* 0xa6 */ "&ordf;",
/* 0xa7 */ "&frac14;",
/* 0xa8 */ "&iquest;",
/* 0xa9 */ "&#8976", /* reversed not */
/* 0xa9 */ "&#8976;", /* reversed not */
/* 0xaa */ "&not;",
/* 0xab */ "&frac12;",
/* 0xac */ "&raquo;",
@@ -874,6 +876,159 @@ static const char* cp850 [] = {
/* 0xfe */ "&#9632;", /* black square */
/* 0xff */ "&nbsp;",
};
#if 1 /* daved - 0.20.3 */
static char * Greek[] =
{
/* 0x80 */ "&ccedil;",
/* 0x81 */ "&uuml;",
/* 0x82 */ "&eacute;",
/* 0x83 */ "&acirc;",
/* 0x84 */ "&auml;",
/* 0x85 */ "&agrave;",
/* 0x86 */ "&aring;",
/* 0x87 */ "&ccedil;",
/* 0x88 */ "&ecirc;",
/* 0x89 */ "&euml;",
/* 0x8a */ "&egrave;",
/* 0x8b */ "&iuml;",
/* 0x8c */ "&icirc;",
/* 0x8d */ "&igrave;",
/* 0x8e */ "&auml;",
/* 0x8f */ "&aring;",
/* 0x90 */ "&eacute;",
/* 0x91 */ "&aelig;",
/* 0x92 */ "&aelig;",
/* 0x93 */ "&ocirc;",
/* 0x94 */ "&ouml;",
/* 0x95 */ "&ograve;",
/* 0x96 */ "&ucirc;",
/* 0x97 */ "&ugrave;",
/* 0x98 */ "&yuml;",
/* 0x99 */ "&ouml;",
/* 0x9a */ "&uuml;",
/* 0x9b */ "&oslash;",
/* 0x9c */ "&pound;",
/* 0x9d */ "&oslash;",
/* 0x9e */ "&times;",
/* 0x9f */ "&#402;", /* small f with hook */
/* 0xa0 */ "&aacute;",
/* 0xa1 */ "&iacute;",
/* 0xa2 */ "&oacute;",
/* 0xa3 */ "&uacute;",
/* 0xa4 */ "&ntilde;",
/* 0xa5 */ "&ntilde;",
/* 0xa6 */ "&ordf;",
/* 0xa7 */ "&frac14;",
/* 0xa8 */ "&iquest;",
/* 0xa9 */ "&reg;",
/* 0xaa */ "&not;",
/* 0xab */ "&frac12;",
/* 0xac */ "&raquo;",
/* 0xad */ "&iexcl;",
/* 0xae */ "&laquo;",
/* 0xaf */ "&ordm;",
/* 0xb0 */ "&#9617;", /* light shade */
/* 0xb1 */ "&#9618;", /* med. shade */
/* 0xb2 */ "&#9619;", /* dark shade */
/* 0xb3 */ "&#9474;", /* box-draw light vert. */
/* 0xb4 */ "&#9508;", /* box-draw light vert. + lt. */
/* 0xb5 */ "&aacute;",
/* 0xb6 */ "&acirc;",
/* 0xb7 */ "&agrave;",
/* 0xb8 */ "&copy;",
/* 0xb9 */ "&#9571;", /* box-draw dbl. vert. + lt. */
/* 0xba */ "&#9553;", /* box-draw dbl. vert. */
/* 0xbb */ "&#9559;", /* box-draw dbl. dn. + lt. */
/* 0xbc */ "&#9565;", /* box-draw dbl. up + lt. */
/* 0xbd */ "&cent;",
/* 0xbe */ "&yen;",
/* 0xbf */ "&#9488;", /* box-draw light dn. + lt. */
/* 0xc0 */ "&#9492;", /* box-draw light up + rt. */
/* 0xc1 */ "&#9524;", /* box-draw light up + horiz. */
/* 0xc2 */ "&#9516;", /* box-draw light dn. + horiz. */
/* 0xc3 */ "&#9500;", /* box-draw light vert. + rt. */
/* 0xc4 */ "&#9472;", /* box-draw light horiz. */
/* 0xc5 */ "&#9532;", /* box-draw light vert. + horiz. */
/* 0xc6 */ "&atilde;",
/* 0xc7 */ "&atilde;",
/* 0xc8 */ "&#9562;", /* box-draw dbl. up + rt. */
/* 0xc9 */ "&#9556;", /* box-draw dbl. dn. + rt. */
/* 0xca */ "&#9577;", /* box-draw dbl. up + horiz. */
/* 0xcb */ "&#9574;", /* box-draw dbl. dn. + horiz. */
/* 0xcc */ "&#9568;", /* box-draw dbl. vert. + rt. */
/* 0xcd */ "&#9552;", /* box-draw dbl. horiz. */
/* 0xce */ "&#9580;", /* box-draw dbl. vert. + horiz. */
/* 0xcf */ "&curren;",
/* 0xd0 */ "&eth;",
/* 0xd1 */ "&eth;",
/* 0xd2 */ "&ecirc;",
/* 0xd3 */ "&euml;",
/* 0xd4 */ "&egrave;",
/* 0xd5 */ "&#305;", /* small dotless i */
/* 0xd6 */ "&iacute;",
/* 0xd7 */ "&icirc;",
/* 0xd8 */ "&iuml;",
/* 0xd9 */ "&#9496;", /* box-draw light up + lt. */
/* 0xda */ "&#9484;", /* box-draw light dn. + rt. */
/* 0xdb */ "&#9608;", /* full-block */
/* 0xdc */ "&#9604;", /* lower 1/2 block */
/* 0xdd */ "&brvbar;",
/* 0xde */ "&igrave;",
/* 0xdf */ "&#9600;", /* upper 1/2 block */
/* 0xe0 */ "&oacute;",
/* above here not done */
/* 0xe1 */ "&alpha;",
/* 0xe2 */ "&beta;",
/* 0xe3 */ "&gamma;",
/* 0xe4 */ "&delta;",
/* 0xe5 */ "&epsilon;",
/* 0xe6 */ "&zeta;",
/* 0xe7 */ "&eta;",
/* 0xe8 */ "&theta;",
/* 0xe9 */ "&iota;",
/* 0xea */ "&kappa;",
/* 0xeb */ "&lambda;",
/* 0xec */ "&mu;",
/* 0xed */ "&nu;",
/* 0xee */ "&xi;",
/* 0xef */ "&omicron;",
/* 0xf0 */ "&pi;",
/* 0xf1 */ "&rho;",
/* 0xf2 */ "&sigmaf;",
/* 0xf3 */ "&sigma;",
/* 0xf4 */ "&tau;",
/* 0xf5 */ "&upsilon;",
/* 0xf6 */ "&phi;",
/* 0xf7 */ "&chi;",
/* 0xf8 */ "&psi;",
/* 0xf9 */ "&omiga;",
/* 0xfa */ "&iotauml;",
/* 0xfb */ "&nuuml;",
/* 0xfc */ "&omicronacute;",
/* 0xfd */ "&nuacute;",
/* 0xfe */ "&omegaacute;", /* black square */
/* 0xff */ "&nbsp;",
};
#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;
}

View File

@@ -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
*--------------------------------------------------------------------*/

View File

@@ -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
*--------------------------------------------------------------------*/

View File

@@ -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

View File

@@ -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);

View File

@@ -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 CHAR %d>", codepage->chars[ch - 0x80]);
if (codepage->chars[ch - 0x80]) {
if(0)
printf("<UNIPRINTING>");
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");
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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
*--------------------------------------------------------------------*/

View File

@@ -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

View File

@@ -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 *);

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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 } }

View File

@@ -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" );

View File

@@ -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

View File

@@ -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() ) ).

View File

@@ -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() );
}