dependencies/mifconv/src/mifconv_mifconverter.cpp
author kashif.sayed
Fri, 26 Mar 2010 01:54:20 +0530
branchv5backport
changeset 26 bef183758dfa
parent 21 11157e26c4a7
permissions -rw-r--r--
Dependencies for idlefw user: kashif.sayed branch 'v5backport'
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     1
/*
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     3
* All rights reserved.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     8
*
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
     9
* Initial Contributors:
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    11
*
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    12
* Contributors:
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    13
*
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    14
* Description:  Mifconv MIF converters class.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    15
*
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    16
*/
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    17
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    18
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    19
#include "mifconv.h"
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    20
#include "mifconv_mifconverter.h"
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    21
#include "mifconv_util.h"
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    22
#include "mifconv_exception.h"
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    23
#include "mifconv_argumentmanager.h"
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    24
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    25
// File versions:
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    26
// V1 - first version.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    27
// V2 - stores information if icon location (MIF/MBM) inside the MIF file (bitmap offsets array).
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    28
// This way, icon IDs in MBG header can be always the same regardless of which icons are in MIF
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    29
// file and which in MBM file.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    30
static const int KFileVersion(2);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    31
static const int KIconVersion(1);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    32
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    33
static const int FileHeaderSizeInBytes = 4*4;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    34
static const int IconHeaderSizeInBytes = 4*8;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    35
static const int KUidAvkonMultiIconFile(0x034232342);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    36
static const int KUidAvkonMultiIcon(0x034232343);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    37
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    38
//static const int IconFormatType_BMP(0);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    39
//static const int IconFormatType_SVG(1);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    40
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    41
static const unsigned int svgbSignatureLow (0x03FA56CC); //66737868
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    42
static const unsigned int svgbSignatureHigh(0x03FA56CF); //66737871
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    43
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    44
static const unsigned int nvgSignatureLow (0x0067766E); //('n'+'v'+'g'+0)
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    45
static const unsigned int nvgSignatureHigh(0xFF67766E); //('n'+'v'+'g'+255)
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    46
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    47
/**
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    48
 *
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    49
 */
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    50
MifConvMifConverter::MifConvMifConverter()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    51
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    52
    MifConvArgumentManager* argMgr = MifConvArgumentManager::Instance();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    53
    iTargetFilename = argMgr->TargetFile();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    54
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    55
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    56
/**
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    57
 *
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    58
 */
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    59
MifConvMifConverter::~MifConvMifConverter()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    60
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    61
    // Delete file contents
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    62
    for( StringPtrVector::iterator i = iContentPointers.begin(); i != iContentPointers.end(); ++i )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    63
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    64
        delete[] *i;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    65
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    66
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    67
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    68
/**
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    69
 *
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    70
 */
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    71
void MifConvMifConverter::Init()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    72
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    73
    CleanupTargetFiles();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    74
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    75
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    76
/**
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    77
 *
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    78
 */
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    79
void MifConvMifConverter::CleanupTargetFiles()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    80
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    81
	if( MifConvUtil::FileExists(iTargetFilename) )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    82
	{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    83
        // Try to remove file MIFCONV_MAX_REMOVE_TRIES times, no exception in case of failure:
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    84
	    MifConvUtil::RemoveFile(iTargetFilename, MIFCONV_MAX_REMOVE_TRIES, true);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    85
	}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    86
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    87
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    88
/**
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    89
 *
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    90
 */
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    91
void MifConvMifConverter::AppendFile( const MifConvSourceFile& sourcefile )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    92
{     
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    93
	if( MifConvUtil::FileExtension( sourcefile.Filename() ) == BMP_FILE_EXTENSION ||
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    94
        MifConvUtil::FileExtension( sourcefile.Filename() ) == SVG_FILE_EXTENSION ||
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    95
        MifConvUtil::FileExtension( sourcefile.Filename() ) == SVGB_BINARY_FILE_EXTENSION )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    96
	{        
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    97
		iSourceFiles.push_back( sourcefile );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    98
	}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
    99
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   100
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   101
void MifConvMifConverter::Convert()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   102
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   103
 	ReadFileContents();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   104
    cout << "Writing mif: " << MifConvArgumentManager::Instance()->TargetFile() << endl;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   105
	ConvertToMif();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   106
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   107
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   108
void MifConvMifConverter::ReadFileContents()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   109
{   
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   110
    for( MifConvSourceFileList::iterator i = iSourceFiles.begin(); i != iSourceFiles.end(); ++i )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   111
    {        
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   112
        // Just read the contents of the .svgb files
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   113
        if( MifConvUtil::FileExtension( i->Filename() ) != BMP_FILE_EXTENSION )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   114
        {            
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   115
            if( MifConvUtil::FileExists(i->Filename()) == false )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   116
            {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   117
                THROW_ERROR_COMMON("Unable to open file for reading! " + i->Filename(), MifConvString(__FILE__), __LINE__ );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   118
            }            
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   119
            cout << "Loading file: " << i->Filename() << endl;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   120
            MifConvFileData retVal = MifConvUtil::FileContents(i->Filename());
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   121
            iContentPointers.push_back(retVal.first); // Save pointer for deleting it later
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   122
            i->SetContent(retVal.first, retVal.second);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   123
        }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   124
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   125
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   126
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   127
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   128
void MifConvMifConverter::Cleanup(bool err)
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   129
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   130
	CleanupTempFiles();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   131
	if( err )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   132
	{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   133
	    CleanupTargetFiles();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   134
	}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   135
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   136
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   137
void MifConvMifConverter::ConvertToMif()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   138
{  
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   139
    try {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   140
        OpenTargetFile();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   141
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   142
    catch( MifConvException& e )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   143
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   144
        // If file creation/opening was not successful, give warning and return:
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   145
        MifConvString debugStr("WARNING: Target file " + iTargetFilename + " cannot be opened for writing.");
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   146
        cout <<  debugStr  << endl;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   147
        MifConvUtil::DebugLog(debugStr);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   148
        return;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   149
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   150
    WriteTargetHeader();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   151
    WriteIconArray();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   152
    WriteIcons();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   153
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   154
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   155
void MifConvMifConverter::OpenTargetFile()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   156
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   157
    iTargetFile.open( iTargetFilename.c_str(), ios::out|ios::binary );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   158
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   159
    if (!iTargetFile.is_open())
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   160
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   161
        // Create path if it does not exist.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   162
        MifConvUtil::EnsurePathExists(iTargetFilename, true);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   163
        iTargetFile.clear();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   164
        iTargetFile.open( iTargetFilename.c_str(), ios::out|ios::binary );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   165
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   166
    if (!iTargetFile.is_open())
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   167
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   168
        THROW_ERROR_COMMON("Cannot write to file! " + iTargetFilename, MifConvString(__FILE__), __LINE__);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   169
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   170
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   171
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   172
void MifConvMifConverter::WriteTargetHeader()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   173
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   174
    size_t arraySize = iSourceFiles.size() * 2;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   175
    int offset = FileHeaderSizeInBytes;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   176
    iTargetFile.write( (char*) &KUidAvkonMultiIconFile, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   177
    iTargetFile.write( (char*) &KFileVersion, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   178
    iTargetFile.write( (char*) &offset, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   179
    iTargetFile.write( (char*) &arraySize, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   180
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   181
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   182
void MifConvMifConverter::CleanupTempFiles()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   183
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   184
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   185
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   186
void MifConvMifConverter::WriteIcons()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   187
{    
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   188
    for( MifConvSourceFileList::iterator i = iSourceFiles.begin(); i != iSourceFiles.end(); ++i )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   189
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   190
        if( i->ContentLength() > 0 )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   191
        {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   192
            WriteIconHeader(*i);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   193
            WriteIconData(*i);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   194
        }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   195
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   196
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   197
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   198
MifConvDefs::IconFormatType MifConvMifConverter::ReadIconBinaryType(const MifConvSourceFile& src)
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   199
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   200
    MifConvDefs::IconFormatType ret = MifConvDefs::IconFormatType_SVG;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   201
    
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   202
    if( src.ContentLength() >= 4 )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   203
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   204
        const char* iconData = src.Content();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   205
        
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   206
        if( iconData[0] == 'n' &&
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   207
            iconData[1] == 'v' &&
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   208
            iconData[2] == 'g' )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   209
        {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   210
            ret = MifConvDefs::IconFormatType_NVG;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   211
        }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   212
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   213
    
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   214
    return ret;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   215
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   216
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   217
void MifConvMifConverter::WriteIconHeader(const MifConvSourceFile& src)
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   218
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   219
    int type = 0;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   220
    if( MifConvUtil::FileExtension(src.Filename()) == BMP_FILE_EXTENSION )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   221
        type = MifConvDefs::IconFormatType_BMP;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   222
    else
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   223
        type = ReadIconBinaryType(src);
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   224
        //type = IconFormatType_SVG;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   225
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   226
    int animated = (int) src.IsAnimated();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   227
    int dataLen = src.ContentLength();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   228
    int depth = src.DisplayMode();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   229
    int mask = src.MaskDisplayMode();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   230
    int dataoffset = IconHeaderSizeInBytes; // 8 = number of writes in this method.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   231
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   232
    iTargetFile.write((char*)&KUidAvkonMultiIcon, 4); // 1
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   233
    iTargetFile.write((char*)&KIconVersion, 4);       // 2
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   234
    iTargetFile.write((char*)&dataoffset, 4);         // 3
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   235
    iTargetFile.write((char*)&dataLen, 4);        // 4
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   236
    iTargetFile.write((char*)&type, 4);          // 5
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   237
    iTargetFile.write((char*)&depth, 4);         // 6
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   238
    iTargetFile.write((char*)&animated, 4);      // 7
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   239
    iTargetFile.write((char*)&mask, 4);     // 8
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   240
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   241
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   242
void MifConvMifConverter::WriteIconData(const MifConvSourceFile& src)
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   243
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   244
    if( src.Content() )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   245
    {        
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   246
        iTargetFile.write(src.Content(), src.ContentLength());
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   247
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   248
}
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   249
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   250
/**
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   251
* 
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   252
*/
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   253
void MifConvMifConverter::WriteIconArray()
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   254
{
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   255
    int offset = (int) FileHeaderSizeInBytes +  (int)iSourceFiles.size()*4*2*2;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   256
    MifConvSourceFileList::iterator i = iSourceFiles.begin();
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   257
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   258
    int mbmIndex = 0;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   259
    int zero = 0;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   260
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   261
    for( ; i != iSourceFiles.end(); ++i )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   262
    {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   263
        // MIF icon
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   264
        if( MifConvUtil::FileExtension(i->Filename()) != BMP_FILE_EXTENSION )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   265
        {            
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   266
            int length = i->ContentLength() + IconHeaderSizeInBytes;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   267
            iTargetFile.write( (char*) &offset, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   268
            iTargetFile.write( (char*) &length, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   269
            // same information for the mask...
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   270
            iTargetFile.write( (char*) &offset, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   271
            iTargetFile.write( (char*) &length, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   272
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   273
            offset += length;            
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   274
        }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   275
        // MBM icon
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   276
        else
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   277
        {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   278
            iTargetFile.write( (char*) &mbmIndex, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   279
            iTargetFile.write( (char*) &zero, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   280
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   281
            // Masked MBM icon -> There is own MBM index for the mask.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   282
            if(i->MaskDepth() != IconMaskDepth_Undefined )
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   283
            {
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   284
                mbmIndex--;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   285
            }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   286
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   287
            iTargetFile.write( (char*) &mbmIndex, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   288
            iTargetFile.write( (char*) &zero, 4 );
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   289
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   290
            // MBM incides are coded as negative in the 'offset' field,
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   291
            // so that they can be easily separated from the actual MIF offsets.
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   292
            mbmIndex--;
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   293
        }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   294
    }
11157e26c4a7 added dependencies for homescreen package
Christian Morlok <symbian.org@christianmorlok.de>
parents:
diff changeset
   295
}